Skip to content

Commit

Permalink
Combined user agent definition in one place.
Browse files Browse the repository at this point in the history
  • Loading branch information
isagalaev committed Jul 18, 2014
1 parent 59c63d4 commit 9fb1ad3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions openid/fetchers.py
Expand Up @@ -15,7 +15,11 @@
import openid


USER_AGENT = "python-openid/%s (%s)" % (openid.__version__, sys.platform)
USER_AGENT = 'python-openid/%s (%s) Python-urllib/%s' % (
openid.__version__,
sys.platform,
urllib.request.__version__,
)
MAX_RESPONSE_KB = 1024


Expand All @@ -38,10 +42,7 @@ def fetch(url, body=None, headers=None):

if headers is None:
headers = {}

headers.setdefault(
'User-Agent',
"%s Python-urllib/%s" % (USER_AGENT, urllib.request.__version__))
headers.setdefault('User-Agent', USER_AGENT)

request = urllib.request.Request(url, data=body, headers=headers)
f = urllib.request.urlopen(request)
Expand Down

0 comments on commit 9fb1ad3

Please sign in to comment.