Perseus RESTful API Client Python Library
Project description
Perseus RESTful API Client Python Library
Repository of classes that provide Pythonic interfaces to connect to a RESTful API server developed with Perseus RESTful API server 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 the
io.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
Hashes for perseus-restful-api-client-library-1.4.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f6c2f87ef5747f8d6a0eec4a8b6cb761e6d4d7ef4844cd54b1a564e2519cbf9 |
|
MD5 | db0738377e0fd19a6c20a342a3c110dd |
|
BLAKE2b-256 | 25d19aa4611c9f0fbf9e5bd40d34bfc96c26c052a33d257bac52249b4e9d1af0 |
Hashes for perseus_restful_api_client_library-1.4.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d24b1dbf7a0058ea47f391c8f5f21f75d687820a93370b689a1c1e40f8868761 |
|
MD5 | 05fedb68909798a67a01d0b1ff065d67 |
|
BLAKE2b-256 | 27c230a1ed78fff86d7913f828746cb9d52ec66f3a371b57beedfc0e369d3ffb |