Skip to content

Instantly share code, notes, and snippets.

@eliask
Created March 3, 2017 14:53
Show Gist options
  • Save eliask/af08649306fd1a080c48b3510f0f4da0 to your computer and use it in GitHub Desktop.
Save eliask/af08649306fd1a080c48b3510f0f4da0 to your computer and use it in GitHub Desktop.
Random Nomador.com API request using Python Requests
#NB. Generated with https://github.com/eliask/curlconverter using "Copy as cURL"
import requests
cookies = {
'gsScrollPos': '',
'NOMADOR_SESSION': '',
}
headers = {
'Accept-Encoding': 'gzip, deflate, sdch, br',
'Accept-Language': 'en-GB,en-US;q=0.8,en;q=0.6',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
'Accept': 'text/html, */*; q=0.01',
'Referer': 'https://www.nomador.com/house-sitting/',
'X-Requested-With': 'XMLHttpRequest',
'Connection': 'keep-alive',
}
params = (
('page', '1'),
('available', ['', '1']),
('location', '0'),
('city[id]', '0'),
('city[locality]', ''),
('city[locality_text]', ''),
('city[administrative_area_level_2]', ''),
('city[administrative_area_level_2_text]', ''),
('city[administrative_area_level_1]', ''),
('city[administrative_area_level_1_text]', ''),
('city[country]', ''),
('city[country_text]', ''),
('city[latitude]', ''),
('city[longitude]', ''),
('city[zoom]', ''),
('city[name]', ''),
('region[id]', '0'),
('region[locality]', ''),
('region[locality_text]', ''),
('region[administrative_area_level_2]', ''),
('region[administrative_area_level_2_text]', ''),
('region[administrative_area_level_1]', ''),
('region[administrative_area_level_1_text]', ''),
('region[country]', ''),
('region[country_text]', ''),
('region[latitude]', ''),
('region[longitude]', ''),
('region[zoom]', ''),
('region[name]', ''),
('country', ''),
('environment', ''),
('population', ''),
('period', '0'),
('date', '2017-03-03'),
('datestart', '2017-03-03'),
('dateend', '2017-06-24'),
('season', ''),
('duration', ''),
('isfd', ''),
('stopover', ''),
)
requests.get('https://www.nomador.com/house-sitting/', headers=headers, params=params, cookies=cookies)
#NB. Original query string below. It seems impossible to parse and
#reproduce query strings 100% accurately so the one below is given
#in case the reproduced version is not "correct".
# requests.get('https://www.nomador.com/house-sitting/?page=1&available=&available=1&location=0&city%5Bid%5D=0&city%5Blocality%5D=&city%5Blocality_text%5D=&city%5Badministrative_area_level_2%5D=&city%5Badministrative_area_level_2_text%5D=&city%5Badministrative_area_level_1%5D=&city%5Badministrative_area_level_1_text%5D=&city%5Bcountry%5D=&city%5Bcountry_text%5D=&city%5Blatitude%5D=&city%5Blongitude%5D=&city%5Bzoom%5D=&city%5Bname%5D=&region%5Bid%5D=0&region%5Blocality%5D=&region%5Blocality_text%5D=&region%5Badministrative_area_level_2%5D=&region%5Badministrative_area_level_2_text%5D=&region%5Badministrative_area_level_1%5D=&region%5Badministrative_area_level_1_text%5D=&region%5Bcountry%5D=&region%5Bcountry_text%5D=&region%5Blatitude%5D=&region%5Blongitude%5D=&region%5Bzoom%5D=&region%5Bname%5D=&country=&environment=&population=&period=0&date=2017-03-03&datestart=2017-03-03&dateend=2017-06-24&season=&duration=&isfd=&stopover=', headers=headers, cookies=cookies)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment