Skip to main content

microrequests

This module makes consuming microservices in Python more efficient. Python’s requests module is fantastic and highly configurable, microrequests builds a wrapper over requests module and enables connection pooling as part of initialisation. This ensures that you use the same connection instead of creating one with every new request, while still working with requests’ clean APIs and mechanism.

This is first version of microrequests and we intend to add more customisation for to consume microservices easily and efficiently.

Installation

The easiest way to install microrequests is using pip

$ pip install microrequests

Usage

To use, simply do:

import microrequests

mr = microrequests.init()
res = mr.get("http://httpbin.org/get") # mr is requests' session object and you can use it in similar manner
print(res.text)

you can also customize max_retries, pool_connections and pool_maxsize - they are by default set to 1, 100 and 50 respectively pool_connections is the number of urllib3 connection pools to cache and poolmaxsize* is the maximum number of connections to save in the pool

import microrequests

mr = microrequests.init(max_retries=2, pool_connections=10, pool_size=5)
res = mr.get("http://httpbin.org/get")
print(res.text)

Tests

To run tests:

$ tox

TODO

  • Write more tests

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/abhinavs/microrequests. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

Code of Conduct

Everyone interacting in the microrequests project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Metadata

Release files for microrequests 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microrequests 0.1.2
File Size Uploaded
microrequests-0.1.2.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for microrequests 0.1.2
File Interpreter ABI Platform
microrequests-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 kB

Release files / microrequests-0.1.2.tar.gz

Download URL microrequests-0.1.2.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7a200026c70f076bc63abc8ee6ac4b4e603afeaf841abb4c54f23a6be062ddc8
BLAKE2b-256 checksum
How to use checksums
6e477ba100689437b5fd76817fad4bd0432c51e5051dc57f2918b8a406c85f86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / microrequests-0.1.2-py3-none-any.whl

Download URL microrequests-0.1.2-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f5d85555dd132b93e8ddc2e85439c6c3bbef89f8b94e6ffa0759abf81d8e293
BLAKE2b-256 checksum
How to use checksums
02945ca603d835eec0a35d90bee32d808d44713dca545044ff3f8e295732fbfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page