Skip to main content

PocketBase SDK for python.

Project description

PocketBase Python SDK

Tests

Python client SDK for the PocketBase backend.

This is in early development, and at first is just a translation of the javascript lib using HTTPX.


Installation

Install PocketBase using PIP:

python3 -m pip install pocketbase

Usage

The rule of thumb here is just to use it as you would the javascript lib, but in a pythonic way of course!

from pocketbase import PocketBase  # Client also works the same
from pocketbase.client import FileUpload

client = PocketBase('http://127.0.0.1:8090')

# authenticate as regular user
user_data = client.collection("users").auth_with_password(
    "user@example.com", "0123456789")

# or as admin
admin_data = client.admins.auth_with_password("test@example.com", "0123456789")

# list and filter "example" collection records
result = client.collection("example").get_list(
    1, 20, {"filter": 'status = true && created > "2022-08-01 10:00:00"'})

# create record and upload file to image field
result = client.collection("example").create(
    {
        "status": "true",
        "image": FileUpload(("image.png", open("image.png", "rb"))),
    })

# and much more...

More detailed API docs and copy-paste examples could be found in the API documentation for each service. Just remember to 'pythonize it' 🙃.

Development

These are the requirements for local development:

You can install locally:

poetry install

Or can build and generate a package:

poetry build

But if you are using only PIP, use this command:

python3 -m pip install -e .

Tests

To execute the tests use this command:

poetry run pytest

License

The PocketBase Python SDK is MIT licensed code.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pocketbasex-0.8.2.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pocketbasex-0.8.2-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file pocketbasex-0.8.2.tar.gz.

File metadata

  • Download URL: pocketbasex-0.8.2.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.0 CPython/3.10.10 Darwin/22.3.0

File hashes

Hashes for pocketbasex-0.8.2.tar.gz
Algorithm Hash digest
SHA256 4d39fc1f19c7582f5b32a37de0f94b75ae749b24bc40dcbb05f19df1fcdb9102
MD5 fa4071c2b5420928b4f080b7cccc1769
BLAKE2b-256 2e7b0bc18ba87429d0942f05d86aedfd437156af7f2deb452f53334b0b7bfba0

See more details on using hashes here.

File details

Details for the file pocketbasex-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: pocketbasex-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.0 CPython/3.10.10 Darwin/22.3.0

File hashes

Hashes for pocketbasex-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1ff10ccedb1ac5e7dd2cf894aaf880ca1dbc36a0130b693b5dc7114e1736abe0
MD5 12c6371d2969c3e1aee86d55d5057903
BLAKE2b-256 02e91b75f426f03adfefcd442ed55ca483cb94495ba098a4522b5d1a800c9cca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page