Skip to content
Myr

Update default user-agent (#2785)

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

* Updated default user agent so that it includes only the requests version; * Added PyCharm / IDEA project directory to `.gitignore`.

authored by Alexandre Sieira · committed by Alexandre Sieira · parent 8963e15 · Browse files · 2 files+2 added−27 removed
This commit

State

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

Diff stats

2 files+2 added−27 removed

  • other:+2 added−27 removed

2 files+2 added−27 removed

modified:requests/utils.py+1 added-27 removed
550 unmodified lines
551 return proxy552553def default_user_agent(name="python-requests"):554 """Return a string representing the default user agent."""555 _implementation = platform.python_implementation()555 return '%s/%s' % (name, __version__)556557 if _implementation == 'CPython':558 _implementation_version = platform.python_version()559 elif _implementation == 'PyPy':560 _implementation_version = '%s.%s.%s' % (sys.pypy_version_info.major,561 sys.pypy_version_info.minor,562 sys.pypy_version_info.micro)563 if sys.pypy_version_info.releaselevel != 'final':564 _implementation_version = ''.join([_implementation_version, sys.pypy_version_info.releaselevel])565 elif _implementation == 'Jython':566 _implementation_version = platform.python_version() # Complete Guess567 elif _implementation == 'IronPython':568 _implementation_version = platform.python_version() # Complete Guess569 else:570 _implementation_version = 'Unknown'557572 try:573 p_system = platform.system()574 p_release = platform.release()575 except IOError:576 p_system = 'Unknown'577 p_release = 'Unknown'578579 return " ".join(['%s/%s' % (name, __version__),580 '%s/%s' % (_implementation, _implementation_version),581 '%s/%s' % (p_system, p_release)])582583558def default_headers():559 return CaseInsensitiveDict({560 'User-Agent': default_user_agent(),561 'Accept-Encoding': ', '.join(('gzip', 'deflate')),
133 unmodified lines
modified:.gitignore+1 added
13 unmodified lines
14*.pyc15*.swp16*.egg17env/18.idea/1920.workon2122t.py
3 unmodified lines