Skip to content
Myr

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

1 file+37 added−46 removed

modified:README.rst+37 added-46 removed
37 unmodified lines
3839It couldn't be simpler. ::4041 >>> import requests42 >>> r = requests.get('http://google.com')434445HTTPS? Basic Authentication? ::46 47 >>> r = requests.get('https://convore.com/api/account/verify.json')48 >>> r.status_code49 4015051 52Uh 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"}65666768API69---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 True8666 >>> 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 84Access stuff. ::8786 >>> r = request.get('https://github.com')87 >>> r.response.status_code()8889HTTP Authentication. ::9091 >>> whoiam = AuthObject('xxx-username', 'xxx-pass')92 >>> request.get(url, params{}, auth=whoiam)9394"Opener" System. ::9596 # all containing given url will automatically auth with given AuthObject97 >>> requests.add_autoauth(url, auth)98 9910088Installation89------------9091To install tablib, simply: ::
5 unmodified lines
97 $ easy_install requests9899But, you really shouldn't do that.100 101102103Contribute104----------105106If 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_.107108109110Roadmap111-------112113- Documentation114- Write it!115- Test it!116- Fo shizzle
3 unmodified lines