| Name | pcloud JSON |
| Version |
2.0.1
JSON |
| download |
| home_page | None |
| Summary | A client library for pCloud |
| upload_time | 2025-11-03 07:33:56 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | None |
| license | None |
| keywords |
python
pcloud
rest
|
| VCS |
|
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# pcloud - A Python API client for pCloud
[](https://github.com/tomgross/pcloud/actions)
This Python **(Version \>= 3.6 only!)** library provides a Python API to
the pCloud storage.
## Features
- Can be used as a library for accessing pCloud Features exposed by
the officiall pCloud API
## Examples
### Usage of API
> \>\>\> from pcloud import PyCloud \>\>\> pc =
> PyCloud(\'<email@example.com>\', \'SecretPassword\') \>\>\>
> pc.listfolder(folderid=0)
Use alternate endpoints (*API calls have to be made to the correct API
host name depending were the user has been registered -- api.pcloud.com
for United States and eapi.pcloud.com for Europe.*)
> \>\>\> from pcloud import PyCloud \>\>\> pc =
> PyCloud(\'<email@example.com>\', \'SecretPassword\',
> endpoint=\"eapi\") \>\>\> pc.listfolder(folderid=0)
PyCloud also provides an API method to retrieve the nearest API server,
which gives you a speed gain for some API operations. To use PyCloud
with this feature create the PyCloud-object with the *nearest* endpoint
parameter:
> \>\>\> from pcloud import PyCloud \>\>\> pc =
> PyCloud(\'<email@example.com>\', \'SecretPassword\',
> endpoint=\"nearest\") \>\>\> pc.listfolder(folderid=0)
#### Binary protocol
pCloud supports JSON and binary format to access its API. By default the
Python pCloud API uses the JSON protocol. To make use of the binary
protocol you need to specify the according endpoints.
For United States server location:
> \>\>\> pc = PyCloud(\'<email@example.com>\', \'SecretPassword\',
> endpoint=\"binapi\")
For Europe server location:
> \>\>\> pc = PyCloud(\'<email@example.com>\', \'SecretPassword\',
> endpoint=\"bineapi\")
The API methods and parameters are identical for both protocols.
### OAuth 2.0 authentication
To use OAuth 2.0 authentication you need to create an App in pCloud
(<https://docs.pcloud.com/my_apps/>).
Add the following redirect URI <http://localhost:65432/> (Make sure port
65432 is available on your machine. Otherwise you need to adjust the
[PORT]{.title-ref} in oauth2.py)
Note! To see the redirect URI in the settings of pCloud you have to log
out and log in again.
Once you finished adding the app and setting the redirect URI you are
ready to use OAuth 2.0 with PyCloud on your machine. For the
communication with pCloud PyCloud uses the builtin
[webserver]{.title-ref}-module. This means you need a real browser on
your system available.
> \>\>\> from pcloud import PyCloud \>\>\> pc =
> PyCloud.oauth2_authorize(client_id=\"XYZ\", client_secret=\"abc123\")
> \>\>\> pc.listfolder(folderid=0)
#### Headless mode
OAuth 2.0 is designed to use a browser for the authentication flow.
Nevertheless Selenium can be used to automate this process. For an
example see the [pycloud_oauth2]{.title-ref}-fixture in
[test_oauth2.py]{.title-ref}. This method will not integrated as main
functionality, since there are too many dependencies. You can use it as
example for your usecase.
### Uploading files
a) from filenames:
> \>\>\> pc.uploadfile(files=\[\'/full/path/to/image1.jpg\',
> \'/Users/tom/another/image.png\'\], \... path=\'/path-to-pcloud-dir\')
b) from data:
> \>\>\> import io \>\>\> from PIL import Image \>\>\> img =
> Image.open(\'image.jpg\', \'r\') \>\>\> bio = io.BytesIO() \>\>\>
> img.save(bio, format=\'jpeg\') \>\>\>
> pc.uploadfile(data=bio.getvalue(), filename=\"image.jpg\",
> path=\'/path-to-pcloud-dir\')
### Downloading files
Since the removal of the file API from pCloud downloading file content
only via the [getzip]{.title-ref}- method. There was a convenience
method added here to download files:
> \>\>\> pc.file_download(fileid=1234567890) b\'xxxx \.... zzzz\'
### Searching files
The pCloud-API allows searching files, even this is not documented in
the official pCloud documentation.
> \>\>\> pcapi.search(query=\"foo\", offset=20, limit=10)
## Known issues
- Some methods (like [listtokens]{.title-ref}, [getzip]{.title-ref})
are not usable when authenticated via OAuth2 (see
<https://github.com/tomgross/pcloud/issues/61>)
- Since the removal of file system operations from the pCloud API
downloading files is no longer supported when authenticated via
OAuth2
## Further Documentation
Implements the pCloud API found at <https://docs.pcloud.com/>
## Installation
> \$ pip install pcloud
## Development
For testing purposes a mock server is provided. To use this mock server
you need to add a file with the same name as the method + the
`.json` suffix in the tests/data directory (like
`getdigest.json`). The file contains the expected JSON
result.
## Contribute
- Issue Tracker: <https://github.com/tomgross/pcloud/issues>
- Source Code: <https://github.com/tomgross/pcloud>
## License
The project is licensed under MIT (see LICENSE).
## Contributors
- Tom Gross, <itconsense@gmail.com>
- Massimo Vannucci (blasterspike)
- Yennick Schepers (yennicks)
- olokelo
- qo4on
Raw data
{
"_id": null,
"home_page": null,
"name": "pcloud",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Python, pCloud, REST",
"author": null,
"author_email": "Tom Gross <itconsense@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/22/80/b0263b6e96c0844e99327079847e73ef741e39c68aac47d0e9cc9cb18f70/pcloud-2.0.1.tar.gz",
"platform": null,
"description": "# pcloud - A Python API client for pCloud\n\n[](https://github.com/tomgross/pcloud/actions)\n\nThis Python **(Version \\>= 3.6 only!)** library provides a Python API to\nthe pCloud storage.\n\n## Features\n\n- Can be used as a library for accessing pCloud Features exposed by\n the officiall pCloud API\n\n## Examples\n\n### Usage of API\n\n> \\>\\>\\> from pcloud import PyCloud \\>\\>\\> pc =\n> PyCloud(\\'<email@example.com>\\', \\'SecretPassword\\') \\>\\>\\>\n> pc.listfolder(folderid=0)\n\nUse alternate endpoints (*API calls have to be made to the correct API\nhost name depending were the user has been registered -- api.pcloud.com\nfor United States and eapi.pcloud.com for Europe.*)\n\n> \\>\\>\\> from pcloud import PyCloud \\>\\>\\> pc =\n> PyCloud(\\'<email@example.com>\\', \\'SecretPassword\\',\n> endpoint=\\\"eapi\\\") \\>\\>\\> pc.listfolder(folderid=0)\n\nPyCloud also provides an API method to retrieve the nearest API server,\nwhich gives you a speed gain for some API operations. To use PyCloud\nwith this feature create the PyCloud-object with the *nearest* endpoint\nparameter:\n\n> \\>\\>\\> from pcloud import PyCloud \\>\\>\\> pc =\n> PyCloud(\\'<email@example.com>\\', \\'SecretPassword\\',\n> endpoint=\\\"nearest\\\") \\>\\>\\> pc.listfolder(folderid=0)\n\n#### Binary protocol\n\npCloud supports JSON and binary format to access its API. By default the\nPython pCloud API uses the JSON protocol. To make use of the binary\nprotocol you need to specify the according endpoints.\n\nFor United States server location:\n\n> \\>\\>\\> pc = PyCloud(\\'<email@example.com>\\', \\'SecretPassword\\',\n> endpoint=\\\"binapi\\\")\n\nFor Europe server location:\n\n> \\>\\>\\> pc = PyCloud(\\'<email@example.com>\\', \\'SecretPassword\\',\n> endpoint=\\\"bineapi\\\")\n\nThe API methods and parameters are identical for both protocols.\n\n### OAuth 2.0 authentication\n\nTo use OAuth 2.0 authentication you need to create an App in pCloud\n(<https://docs.pcloud.com/my_apps/>).\n\nAdd the following redirect URI <http://localhost:65432/> (Make sure port\n65432 is available on your machine. Otherwise you need to adjust the\n[PORT]{.title-ref} in oauth2.py)\n\nNote! To see the redirect URI in the settings of pCloud you have to log\nout and log in again.\n\nOnce you finished adding the app and setting the redirect URI you are\nready to use OAuth 2.0 with PyCloud on your machine. For the\ncommunication with pCloud PyCloud uses the builtin\n[webserver]{.title-ref}-module. This means you need a real browser on\nyour system available.\n\n> \\>\\>\\> from pcloud import PyCloud \\>\\>\\> pc =\n> PyCloud.oauth2_authorize(client_id=\\\"XYZ\\\", client_secret=\\\"abc123\\\")\n> \\>\\>\\> pc.listfolder(folderid=0)\n\n#### Headless mode\n\nOAuth 2.0 is designed to use a browser for the authentication flow.\nNevertheless Selenium can be used to automate this process. For an\nexample see the [pycloud_oauth2]{.title-ref}-fixture in\n[test_oauth2.py]{.title-ref}. This method will not integrated as main\nfunctionality, since there are too many dependencies. You can use it as\nexample for your usecase.\n\n### Uploading files\n\na) from filenames:\n\n> \\>\\>\\> pc.uploadfile(files=\\[\\'/full/path/to/image1.jpg\\',\n> \\'/Users/tom/another/image.png\\'\\], \\... path=\\'/path-to-pcloud-dir\\')\n\nb) from data:\n\n> \\>\\>\\> import io \\>\\>\\> from PIL import Image \\>\\>\\> img =\n> Image.open(\\'image.jpg\\', \\'r\\') \\>\\>\\> bio = io.BytesIO() \\>\\>\\>\n> img.save(bio, format=\\'jpeg\\') \\>\\>\\>\n> pc.uploadfile(data=bio.getvalue(), filename=\\\"image.jpg\\\",\n> path=\\'/path-to-pcloud-dir\\')\n\n### Downloading files\n\nSince the removal of the file API from pCloud downloading file content\nonly via the [getzip]{.title-ref}- method. There was a convenience\nmethod added here to download files:\n\n> \\>\\>\\> pc.file_download(fileid=1234567890) b\\'xxxx \\.... zzzz\\'\n\n### Searching files\n\nThe pCloud-API allows searching files, even this is not documented in\nthe official pCloud documentation.\n\n> \\>\\>\\> pcapi.search(query=\\\"foo\\\", offset=20, limit=10)\n\n## Known issues\n\n- Some methods (like [listtokens]{.title-ref}, [getzip]{.title-ref})\n are not usable when authenticated via OAuth2 (see\n <https://github.com/tomgross/pcloud/issues/61>)\n- Since the removal of file system operations from the pCloud API\n downloading files is no longer supported when authenticated via\n OAuth2\n\n## Further Documentation\n\nImplements the pCloud API found at <https://docs.pcloud.com/>\n\n## Installation\n\n> \\$ pip install pcloud\n\n## Development\n\nFor testing purposes a mock server is provided. To use this mock server\nyou need to add a file with the same name as the method + the\n`.json` suffix in the tests/data directory (like\n`getdigest.json`). The file contains the expected JSON\nresult.\n\n## Contribute\n\n- Issue Tracker: <https://github.com/tomgross/pcloud/issues>\n- Source Code: <https://github.com/tomgross/pcloud>\n\n## License\n\nThe project is licensed under MIT (see LICENSE).\n\n## Contributors\n\n- Tom Gross, <itconsense@gmail.com>\n- Massimo Vannucci (blasterspike)\n- Yennick Schepers (yennicks)\n- olokelo\n- qo4on\n",
"bugtrack_url": null,
"license": null,
"summary": "A client library for pCloud",
"version": "2.0.1",
"project_urls": null,
"split_keywords": [
"python",
" pcloud",
" rest"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3dbefc965d940fcb0daf484d15bf4e2ece913567f003d812496cb2b759ad4bd3",
"md5": "164ba18751298707d83af633e22fd123",
"sha256": "7f5e2a4e91679fa073e1edc508a40a0cdd44eacb56add7952d5d447679d2966a"
},
"downloads": -1,
"filename": "pcloud-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "164ba18751298707d83af633e22fd123",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 22678,
"upload_time": "2025-11-03T07:33:55",
"upload_time_iso_8601": "2025-11-03T07:33:55.446435Z",
"url": "https://files.pythonhosted.org/packages/3d/be/fc965d940fcb0daf484d15bf4e2ece913567f003d812496cb2b759ad4bd3/pcloud-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2280b0263b6e96c0844e99327079847e73ef741e39c68aac47d0e9cc9cb18f70",
"md5": "d5db6a19f49cfb9856feba7ebfb44be0",
"sha256": "cb1aa050826f295e2c0f538ce95e8727bdb5d413981af9b18a1e016a6b35de34"
},
"downloads": -1,
"filename": "pcloud-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "d5db6a19f49cfb9856feba7ebfb44be0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 26644,
"upload_time": "2025-11-03T07:33:56",
"upload_time_iso_8601": "2025-11-03T07:33:56.540812Z",
"url": "https://files.pythonhosted.org/packages/22/80/b0263b6e96c0844e99327079847e73ef741e39c68aac47d0e9cc9cb18f70/pcloud-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-03 07:33:56",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pcloud"
}