Logged Requests
logged_requests is a simple wrapper around the requests.Session object. It captures input and output data of a requests.Session object.
Installation
pip install logged_requests
Quickstart
>>> url = 'https://httpbin.org/post'
>>> from logged_requests import LoggedRequests
>>> req = LoggedRequests()
>>> resp = req.post(url, json={"name":"jsoh"})
2016-04-12 21:09:56 INFO logged_requests.logged_requests.request: POST https://httpbin.org/post
2016-04-12 21:09:57 DEBUG logged_requests.logged_requests.request: Request Headers: Content-Length: 16 | Accept-Encoding: gzip, deflate | Accept: */* | User-Agent: python-requests/2.9.1 | Connection: keep-alive | Content-Type: application/json |
2016-04-12 21:09:57 INFO logged_requests.logged_requests.request: Request Payload: '{"name": "josh"}'
2016-04-12 21:09:57 INFO logged_requests.logged_requests.request: Status code: 200
2016-04-12 21:09:57 DEBUG logged_requests.logged_requests.request: Response Headers: 'Content-Length: 411 | Server: nginx | Connection: keep-alive | Access-Control-Allow-Credentials: true | Date: Tue, 12 Apr 2016 19:09:57 GMT | Access-Control-Allow-Origin: * | Content-Type: application/json | '
2016-04-12 21:09:57 DEBUG logged_requests.logged_requests.request: Response Content: '{\n "args": {}, \n "data": "{\\"name\\": \\"josh\\"}", \n "files": {}, \n "form": {}, \n "headers": {\n "Accept": "*/*", \n "Accept-Encoding": "gzip, deflate", \n "Content-Length": "16", \n "Content-Type": "application/json", \n "Host": "httpbin.org", \n "User-Agent": "python-requests/2.9.1"\n }, \n "json": {\n "name": "josh"\n }, \n "origin": "82.227.125.5", \n "url": "https://httpbin.org/post"\n}\n'
LoggedRequests object can be initiated with a custom logger. If not initiated with a logger, logged_request will initiate a default logger, with StreamHandler as default handler and DEBUG as default loggging level
>>> url = 'https://httpbin.org/post'
>>> from logged_requests import LoggedRequests
>>> req = LoggedRequests(my_custom_logger)
Metadata
Release files for logged_requests 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| logged_requests-0.4.tar.gz | 3.4 kB | Without provenance | Details for logged_requests-0.4.tar.gz |
Release files / logged_requests-0.4.tar.gz
| Download URL | logged_requests-0.4.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9397f5fca3661a86d6670abb369ddea61056478233ea85a8c555a6a4581f3c35
|
|
BLAKE2b-256 checksum How to use checksums |
0fb9dc782a157a44201489a4ceb3cd8c50c721e47d7161502762abc7955cf459
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for logged_requests 0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.