Compare commits

...

6 Commits

Author SHA1 Message Date
Josh McCulloch
99aefa0cda
Added client timeout. (#32) 2023-04-26 20:28:44 -04:00
Vithor Jaeger
9ff559b85e fix version 2023-04-26 20:20:54 -04:00
Vithor Jaeger
99fccb3b0e publish version with oauth fixes 2023-04-26 20:19:45 -04:00
Dan Sikes
c0afb20503
adding dataclass to record model (#33)
Co-authored-by: Dan Sikes <dansikes@Dans-MacBook-Pro.local>
2023-04-09 12:39:09 -04:00
Rafael Stauffer
90bd223664
fix url auth with oauth2 (#36)
Co-authored-by: Rafael Stauffer <rafael.staffer@hotmail.de>
2023-04-09 12:36:31 -04:00
Vithor Jaeger
aacd12bafe
Create python-publish.yml
add auto publishing to Pypi on realease
2023-02-10 14:28:52 -04:00
7 changed files with 50 additions and 8 deletions

39
.github/workflows/python-publish.yml vendored Normal file
View File

@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
on:
release:
types: [published]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

View File

@ -1,6 +1,6 @@
__title__ = "pocketbase" __title__ = "pocketbase"
__description__ = "PocketBase client SDK for python." __description__ = "PocketBase client SDK for python."
__version__ = "0.8.0" __version__ = "0.8.1"
from .client import Client from .client import Client

View File

@ -35,10 +35,12 @@ class Client:
base_url: str = "/", base_url: str = "/",
lang: str = "en-US", lang: str = "en-US",
auth_store: BaseAuthStore | None = None, auth_store: BaseAuthStore | None = None,
timeout: float = 120,
) -> None: ) -> None:
self.base_url = base_url self.base_url = base_url
self.lang = lang self.lang = lang
self.auth_store = auth_store or BaseAuthStore() # LocalAuthStore() self.auth_store = auth_store or BaseAuthStore() # LocalAuthStore()
self.timeout = timeout
# services # services
self.admins = AdminService(self) self.admins = AdminService(self)
self.collections = CollectionService(self) self.collections = CollectionService(self)
@ -94,7 +96,7 @@ class Client:
json=body, json=body,
data=data, data=data,
files=files, files=files,
timeout=120, timeout=self.timeout,
) )
except Exception as e: except Exception as e:
raise ClientResponseError( raise ClientResponseError(

View File

@ -2,12 +2,13 @@ from __future__ import annotations
from pocketbase.models.utils.base_model import BaseModel from pocketbase.models.utils.base_model import BaseModel
from pocketbase.utils import camel_to_snake from pocketbase.utils import camel_to_snake
from dataclasses import dataclass, field
@dataclass
class Record(BaseModel): class Record(BaseModel):
collection_id: str collection_id: str
collection_name: str collection_name: str = ""
expand: dict expand: dict = field(default_factory=dict)
def load(self, data: dict) -> None: def load(self, data: dict) -> None:
super().load(data) super().load(data)

View File

@ -207,7 +207,7 @@ class RecordService(CrudService):
} }
) )
response_data = self.client.send( response_data = self.client.send(
self.base_collection_path() + "/auth-with-password", self.base_collection_path() + "/auth-with-oauth2",
{ {
"method": "POST", "method": "POST",
"params": query_params, "params": query_params,

View File

@ -29,7 +29,7 @@ dynamic = ["readme", "version"]
[tool.poetry] [tool.poetry]
name = "pocketbase" name = "pocketbase"
version = "0.8.0" version = "0.8.1"
description = "PocketBase SDK for python." description = "PocketBase SDK for python."
authors = ["Vithor Jaeger <vaphes@gmail.com>"] authors = ["Vithor Jaeger <vaphes@gmail.com>"]
readme = "README.md" readme = "README.md"

View File

@ -5,7 +5,7 @@ from pocketbase.utils import camel_to_snake, to_datetime
def test_version(): def test_version():
assert __version__ == "0.8.0" assert __version__ == "0.8.1"
def test_utils(): def test_utils():