Skip to content

Instantly share code, notes, and snippets.

@makslevental
Created February 14, 2018 23:15
Show Gist options
  • Save makslevental/accf04a15f2a2de69853e8807595ce1f to your computer and use it in GitHub Desktop.
Save makslevental/accf04a15f2a2de69853e8807595ce1f to your computer and use it in GitHub Desktop.
curl 'https://www.veikkaus.fi/api/hdr/v2/draw-games/draws?game-names=LOTTO&status=RESULTS_AVAILABLE&date-from=1514757600000&date-to=1515362400000' -H 'Cookie: Veikkaus=491852121.20480.0000; esa-tc=wl2fkxjdnoxj503o2zb; TS0150b1a4=0175254fa08aa9144b75648cb8194ff9044d79513e9b07ca2df4271eadb50c4f65173c823f88c3c0d909c3c5892ec10ea849d851d70670447d875e5986f0e0afdc65a50d40; lang=fi' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9' -H 'User-Agent: Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1' -H 'Content-Type: application/json' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'X-ESA-API-Key: WWW' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'Referer: https://www.veikkaus.fi/fi/tulokset' --compressed
->
import requests
cookies = {
'Veikkaus': '491852121.20480.0000',
'esa-tc': 'wl2fkxjdnoxj503o2zb',
'TS0150b1a4': '0175254fa08aa9144b75648cb8194ff9044d79513e9b07ca2df4271eadb50c4f65173c823f88c3c0d909c3c5892ec10ea849d851d70670447d875e5986f0e0afdc65a50d40',
'lang': 'fi',
}
headers = {
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9',
'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
'Content-Type': 'application/json',
'Accept': 'application/json, text/javascript, */*; q=0.01',
'X-ESA-API-Key': 'WWW',
'X-Requested-With': 'XMLHttpRequest',
'Connection': 'keep-alive',
'Referer': 'https://www.veikkaus.fi/fi/tulokset',
}
params = (
('game-names', 'LOTTO'),
('status', 'RESULTS_AVAILABLE'),
('date-from', '1514757600000'),
('date-to', '1515362400000'),
)
response = requests.get('https://www.veikkaus.fi/api/hdr/v2/draw-games/draws', 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".
# response = requests.get('https://www.veikkaus.fi/api/hdr/v2/draw-games/draws?game-names=LOTTO&status=RESULTS_AVAILABLE&date-from=1514757600000&date-to=1515362400000', headers=headers, cookies=cookies)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment