Skip to content

3.0 update from current 2.0 main #1150

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

Merged
merged 2 commits into from
May 28, 2025
Merged
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
7 changes: 7 additions & 0 deletions planet/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ async def alog_response(*args, **kwargs):
self._limiter = _Limiter(rate_limit=RATE_LIMIT, max_workers=MAX_ACTIVE)
self.outcomes: Counter[str] = Counter()

self._loop: asyncio.AbstractEventLoop = None # type: ignore

def _init_loop(self):
if self._loop:
return

# create a dedicated event loop for this httpx session.
def _start_background_loop(loop):
asyncio.set_event_loop(loop)
Expand All @@ -294,6 +300,7 @@ def _start_background_loop(loop):
self._loop_thread.start()

def _call_sync(self, f: Awaitable[T]) -> T:
self._init_loop()
return asyncio.run_coroutine_threadsafe(f, self._loop).result()

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "planet"
authors = [{ name = "Planet", email = "[email protected]" }]
description = "Planet SDK for Python"
dependencies = [
"click>=8.0",
"click (>=8.0,!=8.2.1)",
"geojson",
"httpx>=0.28.0",
"jsonschema",
Expand Down