Skip to content

Commit

Permalink
generate user-agent and accept headers
Browse files Browse the repository at this point in the history
  • Loading branch information
leifj committed Apr 28, 2018
1 parent f0dbe89 commit 884f393
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pyff/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from requests_file import FileAdapter
from requests_cache import CachedSession
import base64
from . import __version__

__author__ = 'leifj'

Expand Down Expand Up @@ -599,8 +600,8 @@ def url_get(url):
backend=config.request_cache_backend,
expire_after=config.request_cache_time,
old_data_on_error=True)

r = s.get(url, verify=False, timeout=config.request_timeout)
headers = {'User-Agent': "pyFF/{}".format(__version__), 'Accept': '*/*'}
r = s.get(url, headers=headers, verify=False, timeout=config.request_timeout)
if config.request_override_encoding is not None:
r.encoding = config.request_override_encoding

Expand Down

0 comments on commit 884f393

Please sign in to comment.