Skip to content
Myr

Merge remote-tracking branch 'origin/master'

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

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 584cfb6, d74bd7e · Browse files · 10 files+28 added−19 removed
This commit

State

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

Diff stats

10 files+28 added−19 removed

  • other:+28 added−19 removed

10 files+28 added−19 removed

modified:docs/user/intro.rst+4 added-4 removed
15 unmodified lines
16#. Readability counts.1718All contributions to Requests should keep these important rules in mind.1920.. _`isc`:20.. _`apache2`:2122ISC License22Apache2 License23-----------2425A large number of open source projects you find today are `GPL Licensed`_.26While the GPL has its time and place, it should most certainly not be your
5 unmodified lines
32The MIT, BSD, ISC, and Apache2 licenses are great alternatives to the GPL33that allow your open-source software to be used freely in proprietary,34closed-source software.3536Requests is released under terms of `The ISC License`_.36Requests is released under terms of `Apache2 License`_.3738.. _`GPL Licensed`: http://www.opensource.org/licenses/gpl-license.php39.. _`The ISC License`: http://www.opensource.org/licenses/isc-license39.. _`Apache2 License`: http://opensource.org/licenses/Apache-2.0404142Requests License43----------------
2 unmodified lines
modified:docs/user/quickstart.rst+4 added-3 removed
135 unmodified lines
136137Raw Response Content138--------------------139140In the rare case that you'd like to get the absolute raw socket response from the server,141you can access ``r.raw``::140In the rare case that you'd like to get the raw socket response from the141server, you can access ``r.raw``. If you want to do this, make sure you set142``prefetch=False`` in your initial request. Once you do, you can do this::143144 >>> r = requests.get('https:/github.com/timeline.json', prefetch=False)145 >>> r.raw146 <requests.packages.urllib3.response.HTTPResponse object at 0x101194810>145147 >>> r.raw.read(10)148 '\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03'149150
345 unmodified lines
modified:docs/index.rst+1 added-1 removed
6 unmodified lines
7=========================89Release v\ |version|. (:ref:`Installation <install>`)1011Requests is an :ref:`ISC Licensed <isc>` HTTP library, written in Python, for human beings.11Requests is an :ref:`Apache2 Licensed <apache2>` HTTP library, written in Python, for human beings.1213Python's standard **urllib2** module provides most of14the HTTP capabilities you need, but the API is thoroughly **broken**.15It was built for a different time — and a different web. It requires an *enormous* amount of work (even method overrides) to perform the simplest of tasks.
117 unmodified lines
modified:requests/__init__.py+2 added-2 removed
35 unmodified lines
36The other HTTP methods are supported - see `requests.api`. Full documentation37is at <http://python-requests.org>.3839:copyright: (c) 2012 by Kenneth Reitz.40:license: ISC, see LICENSE for more details.40:license: Apache 2.0, see LICENSE for more details.4142"""4344__title__ = 'requests'45__version__ = '0.14.2'46__build__ = 0x00140247__author__ = 'Kenneth Reitz'48__license__ = 'ISC'48__license__ = 'Apache 2.0'49__copyright__ = 'Copyright 2012 Kenneth Reitz'505152from . import utils
8 unmodified lines
modified:requests/api.py+2 added-2 removed
5 unmodified lines
67This module implements the Requests API.89:copyright: (c) 2012 by Kenneth Reitz.10:license: ISC, see LICENSE for more details.10:license: Apache2, see LICENSE for more details.1112"""1314from . import sessions
26 unmodified lines
41 # if we're making it just for this call, then close it when we're done.42 adhoc_session = False43 session = kwargs.pop('session', None)44 if session is None:45 session = sessions.session()45 session = sessions.session(config=kwargs.get('config', None))46 adhoc_session = True4748 try:49 return session.request(method=method, url=url, **kwargs)
79 unmodified lines
modified:requests/defaults.py+1 added
41 unmodified lines
42defaults['keep_alive'] = True43defaults['encode_uri'] = True44defaults['trust_env'] = True45defaults['store_cookies'] = True46defaults['support_http0.9'] = True
modified:requests/models.py+3 added-1 removed
231 unmodified lines
232 r = build(resp)233234 if r.status_code in REDIRECT_STATI and not self.redirect:235236 while (('location' in r.headers) and236 while (('location' in r.headers and r.status_code in REDIRECT_STATI) and237 ((r.status_code is codes.see_other) or (self.allow_redirects))):238239 r.content # Consume socket so it can be released240
458 unmodified lines
699 #: value of a ``'Content-Encoding'`` response header.700 self.headers = CaseInsensitiveDict()701702 #: File-like object representation of response (for advanced usage).703 #: Requires that ``prefetch=False` on the request.704 # This requirement does not apply for use internally to Requests.705 self.raw = None706707 #: Final URL location of Response.708 self.url = None
213 unmodified lines
modified:requests/sessions.py+2 added-1 removed
123 unmodified lines
124125 def init_poolmanager(self):126 self.poolmanager = PoolManager(127 num_pools=self.config.get('pool_connections'),128 maxsize=self.config.get('pool_maxsize')128 maxsize=self.config.get('pool_maxsize'),129 strict=not self.config.get('support_http0.9')130 )131132 def __repr__(self):133 return '<requests-client at 0x%x>' % (id(self))
227 unmodified lines
modified:README.rst+8 added-4 removed
3 unmodified lines
45.. image:: https://secure.travis-ci.org/kennethreitz/requests.png?branch=develop6 :target: https://secure.travis-ci.org/kennethreitz/requests78Requests is an ISC Licensed HTTP library, written in Python, for human8Requests is an Apache2 Licensed HTTP library, written in Python, for human9beings.1011Most existing Python modules for sending HTTP requests are extremely12verbose and cumbersome. Python's builtin urllib2 module provides most of
2 unmodified lines
15perform the simplest of tasks.1617Things shouldn't be this way. Not in Python.1819::19.. code-block:: pycon2021 >>> r = requests.get('https://api.github.com', auth=('user', 'pass'))22 >>> r.status_code23 204
29 unmodified lines
5354Installation55------------5657To install requests, simply: ::57To install requests, simply:5859.. code-block:: bash6061 $ pip install requests6261Or, if you absolutely must: ::63Or, if you absolutely must:6465.. code-block:: bash6667 $ easy_install requests6869But, you really shouldn't do that.70
12 unmodified lines
modified:setup.py+1 added-1 removed
43 unmodified lines
44 classifiers=(45 'Development Status :: 5 - Production/Stable',46 'Intended Audience :: Developers',47 'Natural Language :: English',48 'License :: OSI Approved :: ISC License (ISCL)',48 'License :: OSI Approved :: Apache Software License',49 'Programming Language :: Python',50 'Programming Language :: Python :: 2.6',51 'Programming Language :: Python :: 2.7',52 'Programming Language :: Python :: 3',
6 unmodified lines