This python library is a REST API Call which generates REST URLs using attributes.
Project description
REST API CALL
This python library is a REST API Call which generates REST URLs using attributes.",
As an example:
http://example.org/product/kart/customer?id=3&name=foo'
The URI path:
product/kart/customer?id=3&name=foo
with this python library is the sequence:
product.kart.customer(id='3', name='foo')
get()
You can perform the request (Cf. http://docs.python-requests.org/) with get():
>>> import restapicall
>>> conn = restapicall.ApiCall(endpoint='http://example.org')
>>> r = conn.product.kart.customer(id='3', name='foo').get()
>>> r.url
http://example.org/product/kart/customer?id=3&name=foo
>>> r.status_code
404
>>> r.headers['content-type']
'text/html; charset=UTF-8'
get_url()
the url can be get by get_url():
>>> import restapicall
>>> conn = restapicall.ApiCall(endpoint='http://example.org')
>>> r = conn.product(id='3').kart.customer(name='foo').get_url()
>>> print(r)
http://example.org/product/kart/customer?id=3&name=foo'
You can concatenate the attributes. That's exactly the same:
>>> conn = ApiCall(endpoint='http://example.org')
>>> r = conn.product.kart.customer(id='3', name='foo').get_url()
>>> print(r)
http://example.org/product/kart/customer?id=3&name=foo'
License
ISC
Author information
This code was created in 2019 by Olivier Locard.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file RestApiCall-1.0.0.tar.gz.
File metadata
- Download URL: RestApiCall-1.0.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbbbc22c3080ed140bc54a5fbf3ec3e9e776b403d2b60a0958753cefc85ecf6a
|
|
| MD5 |
f259e4976e7bd36a43683d237cc99658
|
|
| BLAKE2b-256 |
2babd379ebe53d5d8820f1e752dc7795bbbe50acff076b1e81c79a426e4ac949
|
File details
Details for the file RestApiCall-1.0.0-py3-none-any.whl.
File metadata
- Download URL: RestApiCall-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1305ecc504c5b22a5dee460357d72f23b0552c9fbd964dfb60bc2d261a2baec
|
|
| MD5 |
560547fe52e0d5d1c0761662c48a7f7a
|
|
| BLAKE2b-256 |
75cf393b6ce3cac48085bca09650004e7c91a11e6578e499b0b996d370cbfbad
|