Skip to content

Commit

Permalink
馃悰 add accept-language header to goingtocamp requests
Browse files Browse the repository at this point in the history
  • Loading branch information
regaw-leinad committed Apr 26, 2024
1 parent 1045ef7 commit 5a81d8d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions camply/providers/going_to_camp/going_to_camp_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,11 @@ def _api_request(
url = None
if endpoint:
url = endpoint.format(hostname)
user_agent = {"User-Agent": UserAgent(browsers=["chrome"]).random}
response = requests.get(url=url, headers=user_agent, params=params, timeout=30)
headers = {
"User-Agent": UserAgent(browsers=["chrome"]).random,
"Accept-Language": "en-US,en;q=0.9",
}
response = requests.get(url=url, headers=headers, params=params, timeout=30)
if response.ok is False:
error_message = f"Receiving bad data from GoingToCamp API: status_code: {response.status_code}: {response.text}"
logger.error(error_message)
Expand Down

0 comments on commit 5a81d8d

Please sign in to comment.