Skip to main content

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

  1. 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

Metadata

Release files for requestwrapper 0.0.5

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

Source distribution (sdist)

Source distribution for requestwrapper 0.0.5
File Size Uploaded
requestwrapper-0.0.5.tar.gz 15.6 kB Details

Built distribution (wheel)

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

Total release size: 21.5 kB

Release files / requestwrapper-0.0.5.tar.gz

Download URL requestwrapper-0.0.5.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
51f1cb1880636b07c1d1a4185a0548617507d736e23779aa23e20e3606034f23
BLAKE2b-256 checksum
How to use checksums
57426be7c059d3bf2cf0b8b11102f1ec648747875efdc549ec3acb6fe3f8fd06
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / requestwrapper-0.0.5-py3-none-any.whl

Download URL requestwrapper-0.0.5-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c1e21ea887ddb3ecebe2574f2068d7fb156c4346d8a5a33b2c8986c3b33af79
BLAKE2b-256 checksum
How to use checksums
03b439085ff6b4acfca129d4b82d01662c0151d1e8805b5d690b04abdb10c806
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 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