Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌿 Fern Regeneration -- December 30, 2023 #7

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "webflow"
version = "0.1.0b1"
version = "0.0.5"
description = ""
readme = "README.md"
authors = []
Expand Down
31 changes: 8 additions & 23 deletions src/webflow/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .environment import WebflowEnvironment
from .oauth import get_access_token
from .resources.access_groups.client import AccessGroupsClient, AsyncAccessGroupsClient
from .resources.assets.client import AssetsClient, AsyncAssetsClient
from .resources.collections.client import AsyncCollectionsClient, CollectionsClient
Expand All @@ -27,22 +26,15 @@ class Webflow:
def __init__(
self,
*,
client_id: str,
client_secret: str,
code: str,
redirect_uri: typing.Optional[str] = None,
base_url: typing.Optional[str] = None,
environment: WebflowEnvironment = WebflowEnvironment.DEFAULT,
access_token: typing.Union[str, typing.Callable[[], str]],
timeout: typing.Optional[float] = 60,
httpx_client: typing.Optional[httpx.Client] = None
):
self._token = get_access_token(
client_id=client_id,
client_secret=client_secret,
code=code,
redirect_uri=redirect_uri)
self._client_wrapper = SyncClientWrapper(
base_url=_get_base_url(base_url=None, environment=environment),
access_token=self._token,
base_url=_get_base_url(base_url=base_url, environment=environment),
access_token=access_token,
httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client,
)
self.token = TokenClient(client_wrapper=self._client_wrapper)
Expand All @@ -65,22 +57,15 @@ class AsyncWebflow:
def __init__(
self,
*,
client_id: str,
client_secret: str,
code: str,
redirect_uri: typing.Optional[str] = None,
base_url: typing.Optional[str] = None,
environment: WebflowEnvironment = WebflowEnvironment.DEFAULT,
access_token: typing.Union[str, typing.Callable[[], str]],
timeout: typing.Optional[float] = 60,
httpx_client: typing.Optional[httpx.AsyncClient] = None
):
self._token = get_access_token(
client_id=client_id,
client_secret=client_secret,
code=code,
redirect_uri=redirect_uri)
self._client_wrapper = AsyncClientWrapper(
base_url=_get_base_url(base_url=None, environment=environment),
access_token=self._token,
base_url=_get_base_url(base_url=base_url, environment=environment),
access_token=access_token,
httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client,
)
self.token = AsyncTokenClient(client_wrapper=self._client_wrapper)
Expand Down
2 changes: 1 addition & 1 deletion src/webflow/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "webflow",
"X-Fern-SDK-Version": "0.1.0b1",
"X-Fern-SDK-Version": "0.0.5",
}
headers["Authorization"] = f"Bearer {self._get_access_token()}"
return headers
Expand Down