No project description provided
Project description
Pyxios
Fusing Python's requests with Javascript's axios.
Setup
Pyxios is a module that wraps requests
methods in a single
instance, centralizing the settings of a given API. Let's use this
https://nonrealapi.com as an example:
from src.pyxios import Pyxios
non_real_api = Pyxios('https://nonrealapi.com/')
get_response = non_real_api.get()
post_response = non_real_api.post(json={'key': 'value'})
Basic Usage
There's no need to provide the base url address and default values of headers, cookies, timeout and/or proxies. The Pyxios instance has on method for each HTTP operation, allowing clarity and agility in the integration with Restfull APIs.
from src.pyxios import Pyxios
non_real_api = Pyxios(
'https://nonrealapi.com/',
headers={
'x-api-key': '$PRIMARY_KEY',
},
timeout=10,
)
get_response = non_real_api.get('resource/1')
delete_response = non_real_api.delete('resource/1', )
# Is also possible to override/update values in each request
patch_response = non_real_api.patch(
'resource/2',
headers={
'x-api-key': '$SECONDARY_KEY',
},
params={'key': 'value'},
)
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
pyxios-1.0.0.tar.gz
(3.2 kB
view hashes)
Built Distribution
pyxios-1.0.0-py3-none-any.whl
(3.5 kB
view hashes)