Merge branch 'develop' into feature/rewrite
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Conflicts: requests/__init__.py test_requests.py
authored by Kenneth Reitz · committed by Kenneth Reitz · parents f9141f5, f5bbb97 · Browse files · 13 files·+94 added−12 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
13 files+94 added−12 removed
- other:+94 added−12 removed
Provenance
- Commit
c48f0d9- Tree
7164479- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent 1
f9141f5- Parent 2
f5bbb97
13 files changed+94 added−12 removed
modified:docs/_themes/kr/static/flasky.css_t+12 added-1 removed
391 unmodified lines392 div.sphinxsidebar {393 display: none;394 }395 396+ div.document {397+ width: 100%;398+399+ }400+401 div.documentwrapper {402 margin-left: 0;403 margin-top: 0;404 margin-right: 0;14 unmodified lines419 .document {420 width: auto;421 }422 423+ .footer {424+ width: auto;425+ }426+427 .bodywrapper {428 margin: 0;429 }430 431 .footer {432 width: auto;433 }434 435+ .github {436+ display: none;437+ }438 427-439 }440 441 442 /* scrollbars */38 unmodified linesmodified:docs/_themes/kr/static/small_flask.css+20 added
66 unmodified lines67686970717273747576777879808182838485868788899066 unmodified linesdiv.body { min-height: 0; padding: 0;}
.rtd_doc_footer { display: none;}
.document { width: auto;}
.footer { width: auto;}
.footer { width: auto;}
.github { display: none;}No newline at end of filemodified:docs/_themes/kr/layout.html+4 added-3 removed
1234556789101112131415151616171819202127 unmodified lines{%- extends "basic/layout.html" %}{%- block extrahead %} {{ super() }} {% if theme_touch_icon %} <link rel="apple-touch-icon" href="{{ pathto('_static/' ~ theme_touch_icon, 1) }}" /> <link rel="apple-touch-icon" href="{{ pathto('_static/' ~ theme_touch_icon, 1) }}" /> {% endif %} <link media="only screen and (max-device-width: 480px)" href="{{ pathto('_static/small_flask.css', 1) }}" type= "text/css" rel="stylesheet" /> <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">{% endblock %}{%- block relbar2 %}{% endblock %}{%- block footer %} <div class="footer"> © Copyright {{ copyright }}. </div> <a href="https://github.com/kennethreitz/requests"> <img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /> <a href="https://github.com/kennethreitz/requests" class="github"> <img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" class="github"/> </a> <script type="text/javascript">
var _gaq = _gaq || [];27 unmodified linesmodified:docs/community/out-there.rst+3 added
5 unmodified lines6 - `robotframework-requests <https://github.com/bulkan/robotframework-requests>`_, a Robot Framework API wrapper.7 - `fullerene <https://github.com/bitprophet/fullerene>`_, a Graphite Dashboard.8 - `urbanairship-python <https://github.com/benjaminws/urbanairship-python>`_, a fork of the Urban Airship API wrapper.9 - `WhitespaceBot <https://github.com/Gunio/WhitespaceBot/>`_, a project that automatically forks repos, strips trailing whitespace, and sends a pull request.10+- `python-rexster <https://github.com/CulturePlex/python-rexster>`_, Rexter client that provides a simple interface for graph databases.11+- `daikon <https://github.com/neogenix/daikon>`_, a CLI for ElasticSearch.12 13 Articles & Talks14 ================15 - `Python for the Web <http://gun.io/blog/python-for-the-web/>`_ teaches how to use Python to interact with the web, using Requests.1 unmodified line17 - `My 'Python for Humans' talk <http://python-for-humans.heroku.com>`_ ( `audio <http://codeconf.s3.amazonaws.com/2011/pycodeconf/talks/PyCodeConf2011%20-%20Kenneth%20Reitz.m4a>`_ )18 - `Issac Kelly's 'Consuming Web APIs' talk <http://issackelly.github.com/Consuming-Web-APIs-with-Python-Talk/slides/slides.html>`_19 - `Blog post about Requests via Yum <http://arunsag.wordpress.com/2011/08/17/new-package-python-requests-http-for-humans/>`_20 - `Russian blog post introducing Requests <http://habrahabr.ru/blogs/python/126262/>`_21+- `French blog post introducing Requests <http://www.nicosphere.net/requests-urllib2-de-python-simplifie-2432/>`_22 23 24 Integrations25 ============41 unmodified linesmodified:docs/user/quickstart.rst+1 added-1 removed
162 unmodified lines163 164 165 -----------------------166 167-Ready for more? Check out the advanced_ section.167+Ready for more? Check out the :ref:`advanced <advanced>` section.modified:docs/index.rst+1 added-1 removed
37 unmodified lines38 39 Testimonials40 ------------41 42-`Twitter, Inc <http://twitter.com>`_,42+`The Washington Post <http://www.washingtonpost.com/>`_, `Twitter, Inc <http://twitter.com>`_,43 a U.S. Federal Institution,44 NIH, 45 `Readability <http://readability.com>`_, and46 `Work for Pie <http://workforpie.com>`_72 unmodified linesmodified:requests/api.py+17 added
27 unmodified lines28 proxies=None,29 hooks=None,30 return_response=True,31 config=None):32+ """Constructs and sends a :class:`Request <Request>`.33+ Returns :class:`Response <Response>` object.34 35+ :param method: method for the new :class:`Request` object.36+ :param url: URL for the new :class:`Request` object.37+ :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.38+ :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.39+ :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.40+ :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.41+ :param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.42+ :param auth: (optional) Auth typle to enable Basic/Digest/Custom HTTP Auth.43+ :param timeout: (optional) Float describing the timeout of the request.44+ :param allow_redirects: (optional) Boolean. Set to True if POST/PUT/DELETE redirect following is allowed.45+ :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.46+ :param return_response: (optional) If False, an un-sent Request object will returned.47+ :param config: (optional) A configuration dictionary.48+ """49+50 s = session()51 return s.request(52 method, url, params, data, headers, cookies, files, auth,53 timeout, allow_redirects, proxies, hooks, return_response,68 unmodified linesmodified:requests/auth.py+2 added-1 removed
65 unmodified lines66 return None67 68 # XXX not implemented yet69 entdig = None70- path = urlparse(r.request.url).path70+ p_parsed = urlparse(r.request.url)71+ path = p_parsed.path + p_parsed.query72 73 A1 = "%s:%s:%s" % (username, realm, password)74 A2 = "%s:%s" % (r.request.method, path)75 71 unmodified linesmodified:requests/models.py+7 added-2 removed
91 unmodified lines92 #: content and metadata of HTTP Response, once :attr:`sent <send>`.93 self.response = Response()94 95 #: Authentication tuple to attach to :class:`Request <Request>`.96+ self._auth = auth97 self.auth = auth_dispatch(auth)98 99 #: CookieJar to attach to :class:`Request <Request>`.100 self.cookies = cookies149 unmodified lines250 files=self.files,251 method=method,252 # data=self.data,253 # params=self.params,253- auth=self.auth,254+ auth=self._auth,255 cookies=self.cookies,256 redirect=True,257 config=self.config,258 _poolmanager=self._poolmanager273 unmodified lines532 raise RuntimeError('The content for this response was '533 'already consumed')534 535 # Read the contents.536+ try:535- self._content = self.raw.read()537+ self._content = self.raw.read()538+ except AttributeError:539+ return None540 541+542 # Decode GZip'd content.543 if 'gzip' in self.headers.get('content-encoding', ''):544 try:545 self._content = decode_gzip(self._content)27 unmodified linesmodified:AUTHORS+3 added-1 removed
45 unmodified lines46 - Josselin Jacquard47 - Travis N. Vaught48 - Fredrik Möllerstrand49 - Daniel Hengeveld50-- Dan Head50+- Dan Head51+- Bruno Renié52+- David Fischermodified:HISTORY.rst+11 added
1 History2 -------3 4+0.7.6 (2011-11-07)5+++++++++++++++++++6+7+* Digest authentication bugfix (attach query data to path)8+9+0.7.5 (2011-11-04)10+++++++++++++++++++11+12+* Response.content = None if there was an invalid repsonse.13+* Redirection auth handling.14+15 0.7.4 (2011-10-26)16 ++++++++++++++++++17 18 * Sesion Hooks fix.223 unmodified linesmodified:README.rst+4 added-2 removed
91 unmodified lines92 93 Contribute94 ----------95 96-If you'd like to contribute, simply fork `the repository`_, commit your changes to the **develop** branch (or branch off of it), and send a pull request. Make sure you add yourself to AUTHORS_.96+#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a Contributor Friendly tag for issues that should be ideal for people who are not very familiar with the codebase yet.97+#. Fork `the repository`_ on Github to start making your changes to the **develop** branch (or branch off of it).98+#. Write a test which shows that the bug was fixed or that the feature works as expected.99+#. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_.100 98-101 .. _`the repository`: http://github.com/kennethreitz/requests102 .. _AUTHORS: http://github.com/kennethreitz/requests/blob/master/AUTHORSmodified:test_requests.py+9 added
546 unmodified lines547 print r.history[0].cookies548 print r.content549 print r.url550 551+ def test_invalid_content(self):552 553+ # WARNING: if you're using a terrible DNS provider (comcast),554+ # this will fail.555+ r = requests.get('http://somedomainthatclearlydoesntexistg.com', allow_redirects=False)556+557+ assert r.content == None558+559+560+561 if __name__ == '__main__':562 unittest.main()