Skip to content

Commit

Permalink
Added User-Agent to request header to avoid Azure Application Gateway…
Browse files Browse the repository at this point in the history
… 403 error.
  • Loading branch information
blebo committed Feb 26, 2023
1 parent 105c825 commit fce102f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fuelwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def getdata(url, use_certifi_ssl=True):
h = httplib2.Http(".cache", ca_certs=certifi.where())
else:
h = httplib2.Http('.cache')
response, content = h.request(url)
response, content = h.request(url, headers={'User-Agent': 'fuelwatch.py'})
#TODO - Catch Exceptions (i.e. if no internet connection).
#decode byte-array to string, us-ascii selected as mime type text/xml
datastring = content.decode("us-ascii")
Expand Down

0 comments on commit fce102f

Please sign in to comment.