Mercurius RESTful API Client Python Library
Project description
Perseus Place RESTful API Client Python Library
Repository of classes that provide Pythonic interfaces to connect to a RESTful API server developed with Perseus RESTful API Framework.
Python Library Poster 0.8.1
Note: this library includes a modified version of poster 0.8.1, which original version provides a set of classes and functions to facilitate making HTTP POST (or PUT) requests using the standard multipart/form-data encoding.
The original library poster 0.8.1 cannot be used to upload file uploaded into memory (i.e., stream-to-memory), like for instance django InMemoryUploadedFile. The reason is that such file-like object doesn't support the method fileno() used by the poster 0.8.1 to determine the size of the file-like object to upload in Python module poster.encode:
if fileobj is not None and filesize is None:
# Try and determine the file size
try:
self.filesize = os.fstat(fileobj.fileno()).st_size
except (OSError, AttributeError):
try:
fileobj.seek(0, 2)
self.filesize = fileobj.tell()
fileobj.seek(0)
except:
raise ValueError("Could not determine filesize")
This code raises the exception io.UnsupportedOperation that poster 0.8.1 doesn't catch. Chris AtLee included Alon Hammerman's patch in the tag tip of the library ``poster, for catching theio.UnsupportedOperation for fileno` on 2013-03-12:
try:
from io import UnsupportedOperation
except ImportError:
UnsupportedOperation = None
(...)
if fileobj is not None and filesize is None:
# Try and determine the file size
try:
self.filesize = os.fstat(fileobj.fileno()).st_size
except (OSError, AttributeError, UnsupportedOperation):
try:
fileobj.seek(0, 2)
self.filesize = fileobj.tell()
fileobj.seek(0)
except:
raise ValueError("Could not determine filesize")
However, the latest version of poster installable with pip is still 0.8.1.
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 mercurius-restful-api-client-library-1.0.0.tar.gz.
File metadata
- Download URL: mercurius-restful-api-client-library-1.0.0.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb5d95bf26f29d6ea2d56c3c5adf23394867631cf005692fefbf41bf3a2e7311
|
|
| MD5 |
ac4341c2bf8c7f88c03ebf4ec1a1bedf
|
|
| BLAKE2b-256 |
d6f271f14e18340ce5b40b8829133dde9e033b76cac0ec411ce87b170f016be7
|
File details
Details for the file mercurius_restful_api_client_library-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mercurius_restful_api_client_library-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ad2432fdb3ce3df829bd08304175c6b04447afff9306add4ef537ec96968833
|
|
| MD5 |
0c430475beeef69c8f3bb9f8cfd787b2
|
|
| BLAKE2b-256 |
8e3ecfa025a74fa093ee3a8eefffb7b25f3398cbe036d033e2a0135417e18178
|