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.
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())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment