Skip to content

Commit

Permalink
Rename Client to PostgrestClient and deprecate the old name
Browse files Browse the repository at this point in the history
  • Loading branch information
lqmanh committed Aug 8, 2020
1 parent 040ad6c commit 1200265
Show file tree
Hide file tree
Showing 6 changed files with 205 additions and 9 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Expand Up @@ -2,19 +2,23 @@

### Unreleased

#### Features
#### Added

- Support basic authentication
- Support stored procedures (RPC)

#### Changed

- Rename `Client` to `PostgrestClient` and deprecate the old name

### v0.1.1

#### Bugfixes
#### Fixed

- Fix a typo in `Client.from_()`

### v0.1.0

#### Features
#### Added

- Add basic features
188 changes: 184 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion postgrest_py/__init__.py
@@ -1 +1,2 @@
from postgrest_py.client import Client
from postgrest_py.__version__ import __version__
from postgrest_py.client import Client, PostgrestClient
1 change: 1 addition & 0 deletions postgrest_py/__version__.py
@@ -0,0 +1 @@
__version__ = "0.1.1"
10 changes: 9 additions & 1 deletion postgrest_py/client.py
@@ -1,9 +1,11 @@
from deprecation import deprecated
from httpx import AsyncClient, Response

from postgrest_py.__version__ import __version__
from postgrest_py.request_builder import RequestBuilder


class Client:
class PostgrestClient:
def __init__(self, base_url: str, *, schema="public") -> None:
headers = {
"Accept": "application/json",
Expand Down Expand Up @@ -51,3 +53,9 @@ async def rpc(self, func: str, params: dict) -> Response:
path = f"/rpc/{func}"
r = await self.session.post(path, json=params)
return r


class Client(PostgrestClient):
@deprecated("0.2.0", "1.0.0", __version__, "Use PostgrestClient instead")
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
2 changes: 2 additions & 0 deletions pyproject.toml
Expand Up @@ -8,9 +8,11 @@ license = "MIT"
[tool.poetry.dependencies]
python = "^3.7"
httpx = "^0.13.3"
deprecation = "^2.1.0"

[tool.poetry.dev-dependencies]
black = {version = "^19.10b0", allow-prereleases = true}
pylint = "^2.5.3"

[build-system]
requires = ["poetry>=0.12"]
Expand Down

0 comments on commit 1200265

Please sign in to comment.