Documentation update
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 71626de · Browse files · 1 file·+37 added−46 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+37 added−46 removed
- other:+37 added−46 removed
Provenance
- Commit
2b54b01- Tree
f077085- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent
71626de
1 file changed+37 added−46 removed
modified:README.rst+37 added-46 removed
37 unmodified lines38 39 It couldn't be simpler. ::40 41 >>> import requests42+ >>> r = requests.get('http://google.com')43+44+45+HTTPS? Basic Authentication? ::46 47+ >>> r = requests.get('https://convore.com/api/account/verify.json')48+ >>> r.status_code49+ 40150+51+ 52+Uh oh, we're not authorized! Let's add authentication. ::53+ 54+ >>> conv_auth = requests.AuthObject('requeststest', 'requeststest')55+ >>> r = requests.get('https://convore.com/api/account/verify.json', conv_auth=auth)56+ 57+ >>> r.status_code58+ 200 59+ 60+ >>> r.headers['content-type']61+ application/json62+ 63+ >>> r.content64+ {"username": "requeststest", "url": "/users/requeststest/", "id": "9408", "img": "censored-long-url"}65+66+67+68+API69+---70+ 71 >>> request.get(url, params={}, headers={} auth=None)72 <response object>73 46- >>> request.put(url, params={}, headers={}, auth=None)74+ >>> request.head(url, params={}, headers={} auth=None)75 <response object>76 49- >>> request.post(url, params={}, headers={}, auth=None)77+ >>> request.put(url, data='', headers={}, auth=None)78 <response object>79 80+ >>> request.post(url, data={}, headers={}, auth=None)81+ <response object>82+ 83 >>> request.delete(url, params={}, headers={}, auth=None)84 <response object>85 55- 56- >>> r = request.Request()57- 58- >>> r.url = 'http://someurl.com/'59- >>> r.add_header(('key', 'value'))60- 61- >>> r.method = 'GET'62- 63- >>> r.send()64- True86 66- >>> dict(r)67- {68- 'url': 'http://someurl.com/',69- 'headers': {70- 'key': 'value',71- }, 72- 'method': 'GET',73- 'response': {74- 'content': <sensored-content>,75- 'status_code': 200,76- 'headers': {77- 'x-runtime': '210ms',78- 'server': 'Apache 2.1',79- 'Content-Type': 'text/html; charset=utf-8'80- }81- }82- }83- 84-Access stuff. ::87 86- >>> r = request.get('https://github.com')87- >>> r.response.status_code()88-89-HTTP Authentication. ::90-91- >>> whoiam = AuthObject('xxx-username', 'xxx-pass')92- >>> request.get(url, params{}, auth=whoiam)93-94-"Opener" System. ::95-96- # all containing given url will automatically auth with given AuthObject97- >>> requests.add_autoauth(url, auth)98- 99-100-88 Installation89 ------------90 91 To install tablib, simply: ::5 unmodified lines97 $ easy_install requests98 99 But, you really shouldn't do that.100 101+102+103 Contribute104 ----------105 106 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_.107 108 109+110 Roadmap111 -------112+113 - Documentation114 - Write it!115 - Test it!116 - Fo shizzle3 unmodified lines