DovaX / reqto

A wrapper around requests to tackle unstable timeout issues

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reqto

A wrapper around requests to tackle unstable timeout issues

Installation

Use the package manager pip to install reqto.

pip install reqto

Usage

import reqto
response = reqto.get(url,timeout=5,timeout_function=custom_function,timeout_args=custom_args)

Example

import reqto

def custom_function(parameter):
    print(parameter)

package="reqto"
response = reqto.get(f'https://pypi.org/pypi/{package}/json',timeout=5,timeout_function=custom_function,timeout_args="Timeout custom function called")
"""Will call timeout_function instead of raising an exception on Timeout"""
print(response)

response = reqto.get(f'https://pypi.org/pypi/{package}/json',timeout=1)
"""Will raise exception on Timeout"""
print(response)

Current scope

Done: GET, POST, PUT, DELETE, PATCH requests working fine with timeout

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

A wrapper around requests to tackle unstable timeout issues

License:MIT License


Languages

Language:Python 100.0%