`requests-dump` provides hook functions for requests.
Project description
Provides a hook function to dump HTTP communiation for requests.
Please, Please, Please note that this library is in pre-alpha phase and its interface is subject to change.
Usage
You may pass the hook function to a requests’ method function.
>>> import requests >>> import reqdump >>> requests.get('http://example.com/', hooks=dict(response=reqdump.dump)) > GET http://example.com/ > Accept-Encoding: gzip, deflate, compress > Accept: */* > User-Agent: python-requests/2.2.1 CPython/2.7.6 Darwin/13.0.2 < 200 OK < content-length: 1270 < x-ec-custom-error: 1 < x-cache: HIT < accept-ranges: bytes < expires: Tue, 11 Feb 2014 13:41:46 GMT < server: ECS (sjc/4FB4) < last-modified: Fri, 09 Aug 2013 23:54:35 GMT < etag: "359670651" < cache-control: max-age=604800 < date: Tue, 04 Feb 2014 13:41:46 GMT < content-type: text/html <!doctype html> <html> (... snip ...) <Response [200]> >>>
You can also apply patch to all requests’ method functions to use the hook function.
>>> import requests >>> import reqdump >>> reqdump.patch() >>> requests.get('http://example.com/') > GET http://example.com/ > Accept-Encoding: gzip, deflate, compress (... snip ...) <Response [200]> >>> reqdump.unpatch() # discard patches >>> requests.get('http://example.com/') <Response [200]> >>>
History
0.1.3
Rename patch() with patch_all() and unpatch() with unpatch_all()
Support HTTP methods other than GET
0.1.2
Add patch() and unpatch() functions
0.1.1
Support Python 3.3
0.1
Birth!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file requests-dump-0.1.3.tar.gz
.
File metadata
- Download URL: requests-dump-0.1.3.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68d718b8bc16fc5304d27c9776b12024e9f447b928b62b7ee8c8de6c2a01d3a0 |
|
MD5 | 7b9f4f16466b38922f8015bd2cd09626 |
|
BLAKE2b-256 | 47e0deffe7f95593c5af43732d8f036537fb9d5ab54b3079bb5f3b19c89ed146 |
File details
Details for the file requests_dump-0.1.3-py3.3.egg
.
File metadata
- Download URL: requests_dump-0.1.3-py3.3.egg
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b19a33de576c54393d7505f33f7885944241ae17a5fc48046cc90d0def1ac870 |
|
MD5 | 3fbe0c8b718c8095d75d58b564a132ac |
|
BLAKE2b-256 | d1cbddd7e55ed052582fe2337306d67c211f23efc22734725d2723df6b73b4b7 |
File details
Details for the file requests_dump-0.1.3-py2.7.egg
.
File metadata
- Download URL: requests_dump-0.1.3-py2.7.egg
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b09902631a0bdd9525dbcbee3e9e3ba7562d60d2bd7ec1fbc88d2d142f5ee9ad |
|
MD5 | d9e4368957c86d8149c8a3e3720ed802 |
|
BLAKE2b-256 | da40a9bc5ab80d34fea6fb6b3d3d8b40e647b9078d60e4bb5d28164fd888b50f |