Skip to content

Instantly share code, notes, and snippets.

@alecbw
Created July 10, 2023 20:12
Show Gist options
  • Save alecbw/1260d3f30de9ab4dee5db94dd127f674 to your computer and use it in GitHub Desktop.
Save alecbw/1260d3f30de9ab4dee5db94dd127f674 to your computer and use it in GitHub Desktop.

Revisions

  1. alecbw created this gist Jul 10, 2023.
    27 changes: 27 additions & 0 deletions SourceStack_Enrich_Company_Jobs.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    import requests
    import json
    import os

    ## Option 1 - query the companies dataset, pull pre-aggregated data

    response = requests.get(
    "https://sourcestack-api.com/companies?url=Copy.ai&fields=open_job_names,open_job_tech_use",
    headers={"X-API-KEY": os.environ["SOURCESTACK_KEY"]}
    )

    ## Option 2 - query jobs directly, aggregate afterwards

    response = requests.post(
    "https://sourcestack-api.com/jobs",
    headers={
    "X-API-KEY": os.environ["SOURCESTACK_KEY"],
    "Content-Type": 'application/json' # this must be included for POSTs
    },
    data=json.dumps({
    "count_only": False,
    "fields": ["job_name", "department", "seniority", "tech_use"],
    "filters": [{"field": "company_url", "operator": "EQUALS", "value": "Copy.ai"}]
    })
    )

    print(response.json())