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.
Metadata
Release files for mercurius-restful-api-client-library 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mercurius-restful-api-client-library-1.0.0.tar.gz | 8.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mercurius_restful_api_client_library-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.3 kB
Release files / mercurius-restful-api-client-library-1.0.0.tar.gz
| Download URL | mercurius-restful-api-client-library-1.0.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb5d95bf26f29d6ea2d56c3c5adf23394867631cf005692fefbf41bf3a2e7311
|
|
BLAKE2b-256 checksum How to use checksums |
d6f271f14e18340ce5b40b8829133dde9e033b76cac0ec411ce87b170f016be7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / mercurius_restful_api_client_library-1.0.0-py3-none-any.whl
| Download URL | mercurius_restful_api_client_library-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ad2432fdb3ce3df829bd08304175c6b04447afff9306add4ef537ec96968833
|
|
BLAKE2b-256 checksum How to use checksums |
8e3ecfa025a74fa093ee3a8eefffb7b25f3398cbe036d033e2a0135417e18178
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|