diff --git a/README.md b/README.md index 2f4afdc..3ea0d80 100644 --- a/README.md +++ b/README.md @@ -21,32 +21,26 @@ $ pip install pocketbase The rule of thumb here is just to use it as you would the javascript lib, but in a pythonic way of course! ```python -from pocketbase import PocketBase # Client also works the same -from pocketbase.client import FileUpload +from pocketbase import PocketBase # Client also works the same 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"'}) +result = client.records.get_list( + "example", 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"))), - }) +# authenticate as regular user +user_data = client.users.auth_via_email("test@example.com", "123456") + +# or as admin +admin_data = client.admins.auth_via_email("test@example.com", "123456") # and much more... ``` > More detailed API docs and copy-paste examples could be found in the [API documentation for each service](https://pocketbase.io/docs/api-authentication). Just remember to 'pythonize it' 🙃. -

The PocketBase Python SDK is MIT licensed code.

+

The PocketBase Python SDK is MIT licensed code.

\ No newline at end of file