Skip to main content

a simple class wrapper to nice URL requests

Project description

niced_url_request

A simple wrapper class to "nice" url requests in python by setting a maximum frequency to url requests, and using a disk cache.

Motivation

I have needed several times lately to get some relatively large dataset from the net as a series of smaller http requests. This class is a convenient small wrapper for doing so without annoying the server.

Functionalities

  • limit request rate
  • cache the answers on disk
  • perform up to 10 re-tries waiting 10 seconds in between if request fails to make querying large quantities of requests robust to minor network / service interruptions

Installation

pip install niced_url_request

Tests and example

To run tests: pytest -v . from the present folder.

For a detailed example: see examples folder.

Small start up example:

from niced_url_request import NicedUrlRequest

niced_requester = NicedUrlRequest()

request_result = niced_requester.perform_request("http://httpbin.org/get?bla1=blabla1")

print(request_result.decode("ASCII"))

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

niced_url_request-0.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

niced_url_request-0.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file niced_url_request-0.1.tar.gz.

File metadata

  • Download URL: niced_url_request-0.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for niced_url_request-0.1.tar.gz
Algorithm Hash digest
SHA256 c2cb6d61ec0226437c6848126adc481989fea279139760be58bec6a0abdae71d
MD5 03c573bb0fac8caefb804cb3c57773ee
BLAKE2b-256 d5c2cda1d14f67eda46eab1509a403bc0ee671bbe5a4112d7b6cbb4fefdf3f68

See more details on using hashes here.

File details

Details for the file niced_url_request-0.1-py3-none-any.whl.

File metadata

  • Download URL: niced_url_request-0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for niced_url_request-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee8c670bbf8b4d25cbf99e3e57f3737b4c0efa799ea159fe9172b4e47da19276
MD5 d6c1f02c836b1731623fe407975c2364
BLAKE2b-256 29a2ad957e30744afa6f8b8f4805547b8a15cceff0f19222804e13ac6d5fc155

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page