Skip to content

Conversation

@yunusemreozdemir
Copy link
Contributor

@yunusemreozdemir yunusemreozdemir commented Dec 24, 2024

This PR adds the optional base_url parameter to QStash clients. This can be used to change the url of the QStash client for development/testing purposes.

qstash/client.py Outdated
http = HttpClient(
token,
retry,
base_url=(base_url or "https://qstash.upstash.io"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for another default here

http = AsyncHttpClient(
token,
retry,
base_url=(base_url or "https://qstash.upstash.io"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for another default here

self,
token: str,
retry: Optional[Union[Literal[False], RetryConfig]],
base_url: str,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be optional with default value None

qstash/http.py Outdated
self,
token: str,
retry: Optional[Union[Literal[False], RetryConfig]],
base_url: str,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be optional with default value none

timeout=DEFAULT_TIMEOUT,
)

self._base_url = base_url
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can make this base_url.rstrip("/") if base_url else BASE_URL to get rid of tri-operand or in every call to request, and restore the rstrip behavior

@CahidArda CahidArda merged commit 9efb145 into main Dec 24, 2024
1 check passed
@CahidArda CahidArda deleted the base-url-fix branch December 24, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants