Skip to content
This repository was archived by the owner on Jun 29, 2023. It is now read-only.

Commit ac7946c

Browse files
committed
Add exact headers of a website request to API call
1 parent 107d372 commit ac7946c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mvg_api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
def _perform_api_request(url):
18-
resp = requests.get(url, headers={'X-MVG-Authorization-Key': api_key})
18+
resp = requests.get(url, headers={'X-MVG-Authorization-Key': api_key, 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'Referer': 'https://www.mvg.de/dienste/abfahrtszeiten.html', 'Sec-Fetch-Mode': 'cors', 'X-Requested-With': 'XMLHttpRequest'})
1919
return resp.json()
2020

2121

0 commit comments

Comments
 (0)