Skip to content

Instantly share code, notes, and snippets.

@chadmhorner
Last active March 14, 2019 14:40
Show Gist options
  • Save chadmhorner/16e56245658fcc637bdc838ccc8c09d6 to your computer and use it in GitHub Desktop.
Save chadmhorner/16e56245658fcc637bdc838ccc8c09d6 to your computer and use it in GitHub Desktop.
from readypipe import requests, starting_task, subtask, schedule, save
JOBS_URL = 'https://www.amazon.jobs/en/search.json?base_query=&city=&country=&county=&facets%5B%5D=location&facets%5B%5D=business_category&facets%5B%5D=category&facets%5B%5D=schedule_type_id&facets%5B%5D=employee_class&facets%5B%5D=normalized_location&facets%5B%5D=job_function_id&latitude=&loc_group_id=&loc_query=&location%5B%5D=newyork&longitude=&offset=10&query_options=&radius=24km&region=&result_limit=10&sort=relevant'
@starting_task
def get_jobs():
jobs = requests.get_json_from_content(JOBS_URL)
data = {}
data['num_jobs'] = jobs.get('hits', None)
save('amazon_jobs', data)
facets = jobs.get('facets', None)
if facets:
locations = facets.get('location_facet', None)
if locations:
for location in locations:
for key, value in location.items():
save('amazon_jobs_locations', {
'location': key,
'jobs': value
})
businesses = facets.get('business_category_facet', None)
if businesses:
for business in businesses:
for key, value in business.items():
save('amazon_jobs_businesses', {
'business': key,
'jobs': value
})
categories = facets.get('category_facet', None)
if categories:
for category in categories:
for key, value in category.items():
save('amazon_jobs_categories', {
'category': key,
'jobs': value
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment