Skip to content
Myr

Made default_user_agent reusable

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This is not exciting change, but will help for people who wants to change name of user agent alone. Also name can be unicode.

authored by kracekumar · committed by kracekumar · parent 4bceb31 · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:requests/utils.py+4 added-4 removed
435 unmodified lines
436 # bypassing the proxy for the current URL.437 return getproxies()438439440def default_user_agent():440def default_user_agent(name=u"python-requests"):441 """Return a string representing the default user agent."""442 _implementation = platform.python_implementation()443444 if _implementation == 'CPython':
17 unmodified lines
462 except IOError:463 p_system = 'Unknown'464 p_release = 'Unknown'465466 return " ".join(['python-requests/%s' % __version__,467 '%s/%s' % (_implementation, _implementation_version),468 '%s/%s' % (p_system, p_release)])466 return " ".join([u'%s/%s' % (name, __version__),467 u'%s/%s' % (_implementation, _implementation_version),468 u'%s/%s' % (p_system, p_release)])469470471def default_headers():472 return CaseInsensitiveDict({
112 unmodified lines