A simple wrapper for the requests package
Project description
requestwrapper
A simple wrapper for the Python requests package
Motivation
Common use cases when dealing with requests are:
- handling response errors
- repeating a request until succesfull response
- executing multiple requests
- saving response (html, pdf) to disk
Requestwrapper implements simple methods to perform such tasks without having to write your own code.
Features
- Parameterize HTTP method using the method-argument
- Handle HTTP errors (status_code>299) by returning the raw response instead of json
- Retry failed requests n-times
- Print request-response to console
- Save response content to disk
Prerequisites
- the requests module (https://pypi.org/project/requests/)
Installing
Hosted on PyPI: (https://pypi.org/project/requestwrapper/) With pip: pip install requestwrapper
Usage
import requestwrapper.Request
#initialize the Request object
Request0=requestwrapper.Request.Request()
# workhorse function: send_request
res=Request0.send_request(url='https://nu.nl',method='GET')
# save response content to disk
Request0.save_response('nu.txt')
Examples
TODO
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file requestwrapper-0.0.5.tar.gz.
File metadata
- Download URL: requestwrapper-0.0.5.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51f1cb1880636b07c1d1a4185a0548617507d736e23779aa23e20e3606034f23
|
|
| MD5 |
f77f0e10a640c4d5d4eb433367561872
|
|
| BLAKE2b-256 |
57426be7c059d3bf2cf0b8b11102f1ec648747875efdc549ec3acb6fe3f8fd06
|
File details
Details for the file requestwrapper-0.0.5-py3-none-any.whl.
File metadata
- Download URL: requestwrapper-0.0.5-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c1e21ea887ddb3ecebe2574f2068d7fb156c4346d8a5a33b2c8986c3b33af79
|
|
| MD5 |
30e25033f7f00d079e8e4468b15d3c77
|
|
| BLAKE2b-256 |
03b439085ff6b4acfca129d4b82d01662c0151d1e8805b5d690b04abdb10c806
|