Migrate new docs over.
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 · parent 98c719f · Browse files · 8 files·+126 added−53 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
8 files+126 added−53 removed
- other:+126 added−53 removed
Provenance
- Commit
4a7fdef- Tree
8187942- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent
98c719f
8 files changed+126 added−53 removed
modified:docs/community/faq.rst+43 added-3 removed
1 unmodified line2 3 Frequently Asked Questions4 ==========================5 6-This part of the documentation covers common questions about Requests.6+This part of the documentation answers common questions about Requests.7 8+Encoded Data?9+-------------10+11+Requests automatically decompresses gzip-encoded responses, and does12+its best to decodes response content to unicode when possible.13+14+You can get direct access to the raw response (and even the socket),15+if needed as well.16+17+18+Custom User-Agents?19+-------------------20+21+Requests allows you to easily override User-Agent strings, along with22+any other HTTP Header.23+24+25 Why not Httplib2?26 -----------------27 28 Chris Adams gave an excellent summary on21 unmodified lines50 51 Python 3 Support?52 -----------------53 37-It's on the way. Here's a list of `supported interpreters <interpreters>`_.54+It's on the way. Here's a list of Python platforms that are officially55+supported:56 57+* cPython 2.558+* cPython 2.5.559+* cPython 2.5.660+* cPython 2.661+* cPython 2.6.662+* cPython 2.6.763+* cPython 2.764+* cPython 2.7.165+* cPython 2.7.266+* PyPy-c 1.467+* PyPy-c 1.568 69+70+Support for Python 3.x is coming *very* soon.71+72+73 Keep-alive Support?74 -------------------75 43-It's on the way.76+It's on the way.77+78+79+Proxy Support?80+--------------81+82+You bet!83+modified:docs/community/updates.rst-1 removed
18 unmodified lines19 20 Follow `@kennethreitz <https://twitter.com/kennethreitz>`_ for updates.21 22 23-23 Mailing List24 ------------25 26 There's a low-volume mailing list for Requests. To subscribe to the4 unmodified linesmodified:docs/user/advanced.rst+2 added-2 removed
64 unmodified lines65 66 67 You can assign a hook function on a per-request basis by passing a68 ``{hook_name: callback_function}`` dictionary to the ``hooks`` request69-paramaeter::69+parameter::70 71 hooks=dict(args=print_url)72 73 That ``callback_function`` will receive a chunk of data as its first59 unmodified lines133 134 >>> requests.settings.verbose = sys.stderr135 >>> requests.get('http://httpbin.org/headers')136 2011-08-17T03:04:23.380175 GET http://httpbin.org/headers137- <Response [200]>137+ <Response [200]>modified:docs/user/install.rst+6 added-3 removed
1 unmodified line2 3 Installation4 ============5 6-This part of the documentation covers the installation of Requests. The first step to using any software package is getting it properly installed.6+This part of the documentation covers the installation of Requests.7+The first step to using any software package is getting it properly installed.8 9 10 Distribute & Pip11 ----------------12 unmodified lines24 25 Cheeseshop Mirror26 -----------------27 27-If the Cheeseshop is down, you can also install Requests from Kenneth Reitz's personal `Cheeseshop mirror <http://pip.kreitz.co/>`_::28+If the Cheeseshop is down, you can also install Requests from Kenneth Reitz's29+personal `Cheeseshop mirror <http://pip.kreitz.co/>`_::30 31 $ pip install -i http://pip.kreitz.co/simple requests32 33 15 unmodified lines49 50 $ curl -O https://github.com/kennethreitz/requests/zipball/master51 52 51-Once you have a copy of the source, you can embed it in your Python package, or install it into your site-packages easily::53+Once you have a copy of the source, you can embed it in your Python package,54+or install it into your site-packages easily::55 56 $ python setup.py installmodified:docs/user/intro.rst+8 added-21 removed
19 unmodified lines20 21 ISC License22 -----------23 24+A large number of open source projects you find today are `GPL Licensed`_.25+While the GPL has its time and place, it should most certainly not be your26+go-to license for your next open source project.27 25-A large number of open source projects you find today are `GPL Licensed`_. While the GPL has its time and place, it should most certainly not be your go-to license for your next open source project.28+A project that is released as GPL cannot be used in any commercial product29+without the product itself also being offered as open source.30 27-A project that is released as GPL cannot be used in any commercial product without the product itself also being offered as open source. The MIT, BSD, ISC, and Apache2 licenses are great alternatives to the GPL that allow your open-source software to be used freely in proprietary, closed-source software.31+The MIT, BSD, ISC, and Apache2 licenses are great alternatives to the GPL32+that allow your open-source software to be used freely in proprietary,33+closed-source software.34 35 Requests is released under terms of `The ISC License`_.36 37 .. _`GPL Licensed`: http://www.opensource.org/licenses/gpl-license.php9 unmodified lines47 48 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.49 50 45-.. _interpreters:46-Python Interpreters47--------------------51 49-At this time, the following Python platforms are officially supported:50-51-* cPython 2.552-* cPython 2.5.553-* cPython 2.5.654-* cPython 2.655-* cPython 2.6.656-* cPython 2.6.757-* cPython 2.758-* cPython 2.7.159-* cPython 2.7.260-* PyPy-c 1.461-* PyPy-c 1.562-63-64-Support for Python 3.x is planned.modified:docs/user/quickstart.rst+8 added-4 removed
3 unmodified lines4 ==========5 6 .. module:: requests.models7 8-Eager to get started? This page gives a good introduction in how to get started with Requests. This assumes you already have Requests installed. If you do not, head over to the :ref:`Installation <install>` section.8+Eager to get started? This page gives a good introduction in how to get started9+with Requests. This assumes you already have Requests installed. If you do not,10+head over to the :ref:`Installation <install>` section.11 12 First, make sure that:13 14 * Requests is :ref:`installed <install>`11 unmodified lines26 Let's get GitHub's public timeline ::27 28 r = requests.get('https://github.com/timeline.json')29 28-Now, we have a :class:`Response` object called ``r``. We can get all the information we need from this.30+Now, we have a :class:`Response` object called ``r``. We can get all the31+information we need from this.32 33 34 Response Content35 ----------------56 unmodified lines92 'etag': '"e1ca502697e5c9317743dc078f67693f"',93 'content-type': 'application/json; charset=utf-8'94 }95 93-The dictionary is special, though: it's made just for HTTP headers. According to `RFC 2616 <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html>`_, HTTP96+The dictionary is special, though: it's made just for HTTP headers. According to97+`RFC 2616 <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html>`_, HTTP98 Headers are case-insensitive.99 100 So, we can access the headers using any capitalization we want::101 19 unmodified lines121 122 >>> print r.cookies123 {'requests-is': 'awesome'}124 121-The underlying CookieJar is also available for more advanced handing::125+The underlying CookieJar is also available for more advanced handling::126 127 >>> r.request.cookiejar128 <cookielib.CookieJar>129 9 unmodified linesmodified:docs/api.rst+48 added-12 removed
11 unmodified lines12 13 Main Interface14 --------------15 16-All of Request's functionality can be accessed by these 6 methods. They17-all return a :class:`Response <models.Response>` object.16+All of Request's functionality can be accessed by these 7 methods.17+They all return an instance of the :class:`Response <Response>` object.18 19+.. autofunction:: request20 .. autofunction:: head21 .. autofunction:: get22 .. autofunction:: post23 .. autofunction:: put24 .. autofunction:: patch25 .. autofunction:: delete25-.. autofunction:: request26 27+28 -----------29 30 30-.. autoclass:: requests.models.Response31+.. autoclass:: Response32 :inherited-members:33 34 34-Exceptions35-----------35 37-.. autoexception:: HTTPError36+Utilities37+---------38 39-.. autoexception:: RequestException39+These functions are used internally, but may be useful outside of40+Requests.41 41-.. autoexception:: requests.models.AuthenticationError42-.. autoexception:: requests.models.URLRequired43-.. autoexception:: requests.models.InvalidMethod42+.. module:: requests.utils43 44+Cookies45+~~~~~~~46 47+.. autofunction:: dict_from_cookiejar48+.. autofunction:: cookiejar_from_dict49+.. autofunction:: add_dict_to_cookiejar50+51+Curl52+~~~~53+.. autofunction:: curl_from_request54+55+Encodings56+~~~~~~~~~57+58+.. autofunction:: get_encodings_from_content59+.. autofunction:: get_encoding_from_headers60+.. autofunction:: get_unicode_from_response61+.. autofunction:: decode_gzip62+63+64 Internals65 ---------66 67 These items are an internal component to Requests, and should never be68 seen by the end user (developer). This part of the API documentation69 exists for those who are extending the functionality of Requests.70 71+Exceptions72+~~~~~~~~~~73+74+.. module:: requests75+76+.. autoexception:: HTTPError77+78+.. autoexception:: RequestException79+80+.. autoexception:: AuthenticationError81+.. autoexception:: URLRequired82+.. autoexception:: InvalidMethod83+.. autoexception:: TooManyRedirects84+85+86+87 Classes88 ~~~~~~~89 56-.. autoclass:: requests.models.Request90+.. autoclass:: requests.Request91 :inherited-members:92+93+modified:docs/index.rst+11 added-7 removed
34 unmodified lines35 multipart files, and parameters with simple Python dictionaries, and access the36 response data in the same way. It's powered by :py:class:`urllib2`, but it does37 all the hard work and crazy hacks for you.38 39-Testimonals40------------39+Testimonials40+------------41 42-`Twitter, Inc <http://twitter.com>`_ uses Requests internally.42+`Twitter, Inc <http://twitter.com>`_,43+a U.S. Federal Institution,44+`Readability <http://readability.com>`_, and45+`Work for Pie <http://workforpie.com>`_46+use Requests internally.47 48+**Armin Ronacher**49+ Requests is the perfect example how beautiful an API can be with the50+ right level of abstraction.51+52 **Daniel Greenfeld**53 Nuked a 1200 LOC spaghetti code library with 10 lines of code thanks to54 @kennethreitz's request library. Today has been AWESOME.55 3 unmodified lines59 60 **Rich Leland**61 Requests is awesome. That is all.62 55-**Steve Pike**56- I can never remember how to do it the regular way.57- ``import requests; requests.get()`` is just so easy!63 59-64 User Guide65 ----------66 67 This part of the documentation, which is mostly prose, begins with some49 unmodified lines