Small library to set default headers in requests
Project description
Requests Defaulter
Small library to set default headers in requests
Currently there's no easy way to set default headers in requests. This patches the requests library to enable default headers to be set across the board.
Using this library
You can install this library from pypi.
To do this using pipenv run:
pipenv install requestsdefaulter
You can then set default headers in requests by running
import requestsdefaulter
def default_header_provider():
return { "X-Your-Header": "Contents Of Header"}
requestsdefaulter.default_headers(default_header_provider)
And make your request as normal
import requests
requests.get("https://example.com")
And your request will contain the header
Developing
These instructions will get you a copy of the project up and running.
Prerequisites
This project uses pipenv.
It expects Python 3.6
Installing
To install the dependencies of this library run
$ pipenv install --dev master ✱ ➜ ◼
Installing dependencies from Pipfile.lock (f97fb9)…
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 11/11 — 00:00:01
To activate this project's virtualenv, run the following:
$ pipenv shell
Running the tests
To run all the tests simply run
make test
Behavioural Tests
We use behave to test the library to run the tests run
pipenv run behave
Security Check
This will check against PEP 508 and for security vulnerabilities in dependencies
pipenv check
Coding Style Checks
Compare the code to pep8
pipenv run flake8
License
This project is licensed under the MIT License - see the LICENSE.md file for details
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
File details
Details for the file requestsdefaulter-0.1.1.tar.gz
.
File metadata
- Download URL: requestsdefaulter-0.1.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5682733d391af907d8e5e95a5470b3b785275f1089a7a7113f1bb288b9d4631a |
|
MD5 | 9a2a023dc6e7fe61327d5c35ca7fb74b |
|
BLAKE2b-256 | 1d0402ac766ec7cca5e40cab5ad6e7272e514598e9d9899f4fb4f1f25b449a9c |