Skip to content
Myr

Update the README

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

authored by digitalxero · committed by digitalxero · parent 3b82b06 · Browse files · 1 file+52 added−25 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+52 added−25 removed

  • other:+52 added−25 removed

1 file+52 added−25 removed

modified:README.rst+52 added-25 removed
1Requests: The Simple (e.g. usable) HTTP Module2==============================================34Most existing Python modules for dealing HTTP requests are insane. I have to look up *everything* that I want to do. Most of my worst Python experiences are a result of the various built-in HTTP libraries (yes, even worse than Logging). 4Most existing Python modules for dealing HTTP requests are insane. I have to look up *everything* that I want to do. Most of my worst Python experiences are a result of the various built-in HTTP libraries (yes, even worse than Logging).56But this one's different. This one's going to be awesome. And simple.78Really simple. 8Really simple.910Features11--------12
1 unmodified line
14 + Simple HTTP Header Request Attachment15 + Simple Data/Params Request Attachment16 + Simple Multipart File Uploads17 + CookieJar Support18 1819- Simple Basic HTTP Authentication20 + Simple URL + HTTP Auth Registry2122
6 unmodified lines
29 >>> r = requests.get('http://google.com')303132HTTPS? Basic Authentication? ::33 3334 >>> r = requests.get('https://convore.com/api/account/verify.json')35 >>> r.status_code36 4013738 3839Uh oh, we're not authorized! Let's add authentication. ::40 41 >>> conv_auth = requests.AuthObject('requeststest', 'requeststest')4041 >>> conv_auth = ('requeststest', 'requeststest')42 >>> r = requests.get('https://convore.com/api/account/verify.json', auth=conv_auth)43 4344 >>> r.status_code45 200 46 45 2004647 >>> r.headers['content-type']48 'application/json'49 4950 >>> r.content51 '{"username": "requeststest", "url": "/users/requeststest/", "id": "9408", "img": "censored-long-url"}'52535455API56---57 5758**Requests:**5960All request functions return a Response object (see below).6162If a {filename: fileobject} dictionary is passed in (files=...), a multipart_encode upload will be performed.63If CookieJar object is is passed in (cookies=...), the cookies will be sent with the request.64 6465 GET Requests66 >>> request.get(url, params={}, headers={}, cookies=None, auth=None)67 <request object>68 6869 HEAD Requests70 >>> request.head(url, params={}, headers={}, cookies=None, auth=None)71 <request object>72 7273 PUT Requests74 >>> request.put(url, data='', headers={}, files={}, cookies=None, auth=None)75 <request object>76 7677 POST Requests78 >>> request.post(url, data={}, headers={}, files={}, cookies=None, auth=None)79 <request object>80 8081 DELETE Requests82 >>> request.delete(url, params={}, headers={}, cookies=None, auth=None)83 <request object>84 8485**AsyncRequests:**8687All request functions return a Response object (see below).8889If a {filename: fileobject} dictionary is passed in (files=...), a multipart_encode upload will be performed.90If CookieJar object is is passed in (cookies=...), the cookies will be sent with the request.9192 GET Requests93 >>> request.async.get(url, params={}, headers={}, cookies=None, auth=None)94 <request object>9596 HEAD Requests97 >>> request.async.head(url, params={}, headers={}, cookies=None, auth=None)98 <request object>99100 PUT Requests101 >>> request.async.put(url, data='', headers={}, files={}, cookies=None, auth=None)102 <request object>103104 POST Requests105 >>> request.async.post(url, data={}, headers={}, files={}, cookies=None, auth=None)106 <request object>107108 DELETE Requests109 >>> request.async.delete(url, params={}, headers={}, cookies=None, auth=None)110 <request object>111112113**Responses:**87 114115 Response.status_code:116 (Integer) Received HTTP Status Code Response117118 Response.headers:
2 unmodified lines
121 Response.content:122 (Bytes) Received Content123124 Response.url98 (String) URL of response. Useful for detecting redirects. 99 125 (String) URL of response. Useful for detecting redirects.126127 Response.ok128 (Bool) True if no errors occurred during the request, and the status_code is kosher.102 129130 Response.error131 (HTTPError) If an HTTPError occurred (e.g. status of 404), Otherwise this is None.105 132133 Response.raise_for_status()134 Raises HTTPError if a request is not kosher.135136
10 unmodified lines
147148To install requests, simply: ::149150 $ pip install requests124 151152Or, if you absolutely must: ::153154 $ easy_install requests155156But, you really shouldn't do that.130 157158159160Contribute161----------162163If 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_.
13 unmodified lines