supabase_functions 0.8.0__tar.gz → 0.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {supabase_functions-0.8.0 → supabase_functions-0.9.0}/PKG-INFO +2 -1
- {supabase_functions-0.8.0 → supabase_functions-0.9.0}/pyproject.toml +2 -1
- {supabase_functions-0.8.0 → supabase_functions-0.9.0}/supabase_functions/__init__.py +1 -0
- {supabase_functions-0.8.0 → supabase_functions-0.9.0}/supabase_functions/_async/functions_client.py +15 -3
- {supabase_functions-0.8.0 → supabase_functions-0.9.0}/supabase_functions/_sync/functions_client.py +15 -3
- {supabase_functions-0.8.0 → supabase_functions-0.9.0}/supabase_functions/utils.py +25 -0
- supabase_functions-0.9.0/supabase_functions/version.py +1 -0
- supabase_functions-0.8.0/supabase_functions/version.py +0 -1
- {supabase_functions-0.8.0 → supabase_functions-0.9.0}/LICENSE +0 -0
- {supabase_functions-0.8.0 → supabase_functions-0.9.0}/README.md +0 -0
- {supabase_functions-0.8.0 → supabase_functions-0.9.0}/supabase_functions/_async/__init__.py +0 -0
- {supabase_functions-0.8.0 → supabase_functions-0.9.0}/supabase_functions/_sync/__init__.py +0 -0
- {supabase_functions-0.8.0 → supabase_functions-0.9.0}/supabase_functions/errors.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: supabase_functions
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Library for Supabase Functions
|
|
5
5
|
Home-page: https://github.com/supabase/functions-py
|
|
6
6
|
License: MIT
|
|
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
16
|
Requires-Dist: httpx[http2] (>=0.26,<0.28)
|
|
17
|
+
Requires-Dist: strenum (>=0.4.15,<0.5.0)
|
|
17
18
|
Project-URL: Repository, https://github.com/supabase/functions-py
|
|
18
19
|
Description-Content-Type: text/markdown
|
|
19
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "supabase_functions"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.9.0" # {x-release-please-version}
|
|
4
4
|
description = "Library for Supabase Functions"
|
|
5
5
|
authors = [
|
|
6
6
|
"Joel Lee <joel@joellee.org>",
|
|
@@ -13,6 +13,7 @@ repository = "https://github.com/supabase/functions-py"
|
|
|
13
13
|
[tool.poetry.dependencies]
|
|
14
14
|
python = "^3.9"
|
|
15
15
|
httpx = {version = ">=0.26,<0.28", extras = ["http2"]}
|
|
16
|
+
strenum = "^0.4.15"
|
|
16
17
|
|
|
17
18
|
[tool.poetry.group.dev.dependencies]
|
|
18
19
|
black = ">=23.9.1,<25.0.0"
|
{supabase_functions-0.8.0 → supabase_functions-0.9.0}/supabase_functions/_async/functions_client.py
RENAMED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
from typing import Any, Dict, Literal, Optional, Union
|
|
2
|
+
from warnings import warn
|
|
2
3
|
|
|
3
4
|
from httpx import HTTPError, Response
|
|
4
5
|
|
|
5
6
|
from ..errors import FunctionsHttpError, FunctionsRelayError
|
|
6
|
-
from ..utils import
|
|
7
|
+
from ..utils import (
|
|
8
|
+
AsyncClient,
|
|
9
|
+
FunctionRegion,
|
|
10
|
+
is_http_url,
|
|
11
|
+
is_valid_jwt,
|
|
12
|
+
is_valid_str_arg,
|
|
13
|
+
)
|
|
7
14
|
from ..version import __version__
|
|
8
15
|
|
|
9
16
|
|
|
@@ -88,8 +95,13 @@ class AsyncFunctionsClient:
|
|
|
88
95
|
response_type = invoke_options.get("responseType", "text/plain")
|
|
89
96
|
|
|
90
97
|
region = invoke_options.get("region")
|
|
91
|
-
if region
|
|
92
|
-
|
|
98
|
+
if region:
|
|
99
|
+
if not isinstance(region, FunctionRegion):
|
|
100
|
+
warn(f"Use FunctionRegion({region})")
|
|
101
|
+
region = FunctionRegion(region)
|
|
102
|
+
|
|
103
|
+
if region.value != "any":
|
|
104
|
+
headers["x-region"] = region.value
|
|
93
105
|
|
|
94
106
|
body = invoke_options.get("body")
|
|
95
107
|
if isinstance(body, str):
|
{supabase_functions-0.8.0 → supabase_functions-0.9.0}/supabase_functions/_sync/functions_client.py
RENAMED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
from typing import Any, Dict, Literal, Optional, Union
|
|
2
|
+
from warnings import warn
|
|
2
3
|
|
|
3
4
|
from httpx import HTTPError, Response
|
|
4
5
|
|
|
5
6
|
from ..errors import FunctionsHttpError, FunctionsRelayError
|
|
6
|
-
from ..utils import
|
|
7
|
+
from ..utils import (
|
|
8
|
+
FunctionRegion,
|
|
9
|
+
SyncClient,
|
|
10
|
+
is_http_url,
|
|
11
|
+
is_valid_jwt,
|
|
12
|
+
is_valid_str_arg,
|
|
13
|
+
)
|
|
7
14
|
from ..version import __version__
|
|
8
15
|
|
|
9
16
|
|
|
@@ -88,8 +95,13 @@ class SyncFunctionsClient:
|
|
|
88
95
|
response_type = invoke_options.get("responseType", "text/plain")
|
|
89
96
|
|
|
90
97
|
region = invoke_options.get("region")
|
|
91
|
-
if region
|
|
92
|
-
|
|
98
|
+
if region:
|
|
99
|
+
if not isinstance(region, FunctionRegion):
|
|
100
|
+
warn(f"Use FunctionRegion({region})")
|
|
101
|
+
region = FunctionRegion(region)
|
|
102
|
+
|
|
103
|
+
if region.value != "any":
|
|
104
|
+
headers["x-region"] = region.value
|
|
93
105
|
|
|
94
106
|
body = invoke_options.get("body")
|
|
95
107
|
if isinstance(body, str):
|
|
@@ -1,13 +1,38 @@
|
|
|
1
1
|
import re
|
|
2
|
+
import sys
|
|
2
3
|
from urllib.parse import urlparse
|
|
3
4
|
|
|
4
5
|
from httpx import AsyncClient as AsyncClient # noqa: F401
|
|
5
6
|
from httpx import Client as BaseClient
|
|
6
7
|
|
|
8
|
+
if sys.version_info >= (3, 11):
|
|
9
|
+
from enum import StrEnum
|
|
10
|
+
else:
|
|
11
|
+
from strenum import StrEnum
|
|
12
|
+
|
|
13
|
+
|
|
7
14
|
DEFAULT_FUNCTION_CLIENT_TIMEOUT = 5
|
|
8
15
|
BASE64URL_REGEX = r"^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$"
|
|
9
16
|
|
|
10
17
|
|
|
18
|
+
class FunctionRegion(StrEnum):
|
|
19
|
+
Any = "any"
|
|
20
|
+
ApNortheast1 = "ap-northeast-1"
|
|
21
|
+
ApNortheast2 = "ap-northeast-2"
|
|
22
|
+
ApSouth1 = "ap-south-1"
|
|
23
|
+
ApSoutheast1 = "ap-southeast-1"
|
|
24
|
+
ApSoutheast2 = "ap-southeast-2"
|
|
25
|
+
CaCentral1 = "ca-central-1"
|
|
26
|
+
EuCentral1 = "eu-central-1"
|
|
27
|
+
EuWest1 = "eu-west-1"
|
|
28
|
+
EuWest2 = "eu-west-2"
|
|
29
|
+
EuWest3 = "eu-west-3"
|
|
30
|
+
SaEast1 = "sa-east-1"
|
|
31
|
+
UsEast1 = "us-east-1"
|
|
32
|
+
UsWest1 = "us-west-1"
|
|
33
|
+
UsWest2 = "us-west-2"
|
|
34
|
+
|
|
35
|
+
|
|
11
36
|
class SyncClient(BaseClient):
|
|
12
37
|
def aclose(self) -> None:
|
|
13
38
|
self.close()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.9.0" # {x-release-please-version}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.8.0" # {x-release-please-version}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|