Install third-party dependencies
For better async support, you can opt for the httpx package. Adapt the code below accordingly.
pip install requests
Important notes:
- the GET parameters <USER_IP> and <USER_AGENT> are required and must be replaced by actual values.
- the header field
Refereris required and contains the page from which the API call was initially triggered. For example, if your page ishttps://example-publisher-site.com/find-jobs/, then the Referer field should contain exactly that. - the fields
searchandlocationare optional but are limited to your country
Example code
import requests
hostname = 'search.api.careerjet.net'
path = '/v4/query'
api_key = '<API_KEY>'
referer = 'https://example-publisher-site.com/find-jobs/?s=python+developer&l=London'
params = {
'locale_code': 'en_IM',
'keywords': 'python developer',
'location': 'London',
'user_ip': '<USER_IP>',
'user_agent': '<USER_AGENT>',
}
r = requests.get(
url=f'https://{hostname}{path}',
params=params,
auth=(api_key, ''),
headers={
'content-type': 'application/json',
'Referer': referer,
},
timeout=2
)
print(r.status_code)
print(r.json())