Pythonista API Client
Installation
There's a package on PyPI just type:
pip install pythonista_api_client
Desktop
To test your installation you can try one of the examples:
python examples/konektom.py
iOS
Before you are able to install the package from PyPI, you have to install StaSh a shell for pythonista.
Api
To create an api client just inherit from BaseClient which will handle authentication and settings for you. Requests should be done by importing requests from api client which will then behave like the usual requests module.
Depending on which platform your script will be run one of following methods will be called:
- python_main (normal python)
- pythonista_main (started with pythonista play button)
- appex_main (invoked via share sheet)
Token Authentication
If you wnat to use token authentication you need to set obtain_token_endpoint.
JWT Authentication
For JWT Authentication obtain_jwt_endpoint and refresh_jwt_endpoint have to be set.
Example with token authentictaion
Here's a minimal example which should work with token and jwt authentication:
from urllib.parse import urljoin
from api_client import requests
from api_client import BaseClient
class Bookmark(BaseClient):
obtain_jwt_endpoint = 'api/auth/token/obtain/'
refresh_jwt_endpoint = 'api/auth/token/refresh/'
obtain_token_endpoint = '/api/api-token-auth/'
bookmarks_endpoint = 'api/v1/bookmarks/'
def list_bookmarks(self):
list_url = urljoin(self.base_url, self.bookmarks_endpoint)
return requests.get(list_url, auth=self.auth).json()
def python_main(self):
print('running in normal python')
print(self.list_bookmarks())
def pythonista_main(self):
print('Running in Pythonista app, using test data...\n')
print(self.list_bookmarks())
def appex_main(self):
print('running in share sheet')
print(self.list_bookmarks())
def main():
Bookmark(auth_method='token').main()
if __name__ == '__main__':
main()
Metadata
Release files for pythonista-api-client 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pythonista_api_client-0.1.4.tar.gz | 5.7 kB | Without provenance | Details for pythonista_api_client-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pythonista_api_client-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for pythonista_api_client-0.1.4-py3-none-any.whl |
Total release size: 11.4 kB
Release files / pythonista_api_client-0.1.4.tar.gz
| Download URL | pythonista_api_client-0.1.4.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9fe100d39b823b335ada77e6cc1c2d7b1b4d233c6e418f42b1f6bffeee59ed5b
|
|
BLAKE2b-256 checksum How to use checksums |
f3c286df9ec100764685fb5c2c4e0dfdd273ba1d7987148d04f429f7b24552cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pythonista_api_client-0.1.4-py3-none-any.whl
| Download URL | pythonista_api_client-0.1.4-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f4bd34fe2b446165b30c456081e5940de17eabe6a5e5b855336ca7f0b793c2d
|
|
BLAKE2b-256 checksum How to use checksums |
0fb193e262257cb6c597a658c1c97e55665ac65d2050db1214d22830200df6d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pythonista-api-client 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.