# 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`:
```python
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:
```python
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`.
Raw data
{
"_id": null,
"home_page": "https://github.com/majormode/perseus-restful-api-client-python-library",
"name": "perseus-restful-api-client-library",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "perseus,resful,api,server,framework",
"author": "Daniel CAUNE",
"author_email": "daniel.caune@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/bd/77/f4f02be46eb38095671eaa8a7c17c0d378d570ad96b411cde76f9b0220a3/perseus_restful_api_client_library-1.4.12.tar.gz",
"platform": null,
"description": "# Perseus RESTful API Client Python Library\n\nRepository of classes that provide Pythonic interfaces to connect to a RESTful API server developed with Perseus RESTful API server framework.\n\n## Python Library `Poster 0.8.1`\n\nNote: 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.\n\nThe 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`:\n\n```python\nif fileobj is not None and filesize is None:\n # Try and determine the file size\n try:\n self.filesize = os.fstat(fileobj.fileno()).st_size\n except (OSError, AttributeError):\n try:\n fileobj.seek(0, 2)\n self.filesize = fileobj.tell()\n fileobj.seek(0)\n except:\n raise ValueError(\"Could not determine filesize\")\n```\n\nThis 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:\n\n```python\ntry:\n from io import UnsupportedOperation\nexcept ImportError:\n UnsupportedOperation = None\n\n(...)\n\nif fileobj is not None and filesize is None:\n # Try and determine the file size\n try:\n self.filesize = os.fstat(fileobj.fileno()).st_size\n except (OSError, AttributeError, UnsupportedOperation):\n try:\n fileobj.seek(0, 2)\n self.filesize = fileobj.tell()\n fileobj.seek(0)\n except:\n raise ValueError(\"Could not determine filesize\")\n```\n\nHowever, the latest version of `poster` installable with `pip` is still `0.8.1`.\n",
"bugtrack_url": null,
"license": "see LICENSE.md",
"summary": "Perseus RESTful API Client Python Library",
"version": "1.4.12",
"project_urls": {
"Homepage": "https://github.com/majormode/perseus-restful-api-client-python-library",
"Repository": "https://github.com/majormode/perseus-restful-api-client-python-library"
},
"split_keywords": [
"perseus",
"resful",
"api",
"server",
"framework"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7a7ec054889195e5d340cd47dd91c866cca9e72d7f14b14f59f2ceebb7dbbd57",
"md5": "c776241200054b3eaef1ef3edda4c4f6",
"sha256": "97c3061881d45e195b6d01ca6e67642af084f5d06bde1b65aa117a162b2bdf27"
},
"downloads": -1,
"filename": "perseus_restful_api_client_library-1.4.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c776241200054b3eaef1ef3edda4c4f6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 40376,
"upload_time": "2024-02-26T13:27:22",
"upload_time_iso_8601": "2024-02-26T13:27:22.176844Z",
"url": "https://files.pythonhosted.org/packages/7a/7e/c054889195e5d340cd47dd91c866cca9e72d7f14b14f59f2ceebb7dbbd57/perseus_restful_api_client_library-1.4.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bd77f4f02be46eb38095671eaa8a7c17c0d378d570ad96b411cde76f9b0220a3",
"md5": "e974bdabfe720bdb66770b7c1c32ba82",
"sha256": "830e8d8b3444c5cc01c5a7f6912adc24579553d92bef1acf859f0643b3fb918c"
},
"downloads": -1,
"filename": "perseus_restful_api_client_library-1.4.12.tar.gz",
"has_sig": false,
"md5_digest": "e974bdabfe720bdb66770b7c1c32ba82",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 25099,
"upload_time": "2024-02-26T13:27:24",
"upload_time_iso_8601": "2024-02-26T13:27:24.910561Z",
"url": "https://files.pythonhosted.org/packages/bd/77/f4f02be46eb38095671eaa8a7c17c0d378d570ad96b411cde76f9b0220a3/perseus_restful_api_client_library-1.4.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-26 13:27:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "majormode",
"github_project": "perseus-restful-api-client-python-library",
"github_not_found": true,
"lcname": "perseus-restful-api-client-library"
}