Skip to content
Permalink
Browse files

Combined user agent definition in one place.

  • Loading branch information...
isagalaev committed Jul 18, 2014
1 parent 59c63d4 commit 9fb1ad348c14a84398747400a38b19227c87a0d1
Showing with 6 additions and 5 deletions.
  1. +6 −5 openid/fetchers.py
@@ -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


@@ -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)

0 comments on commit 9fb1ad3

Please sign in to comment.
You can’t perform that action at this time.