Skip to content

Commit

Permalink
feat: bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
joschkabraun committed Jan 25, 2024
1 parent 295589a commit feda0f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions parea/api_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import Any, Callable, Optional

import asyncio
import time
from functools import wraps
from typing import Any, Optional, Callable

import httpx

Expand All @@ -11,6 +12,7 @@

def retry_on_502(func: Callable[..., Any]) -> Callable[..., Any]:
if asyncio.iscoroutinefunction(func):

@wraps(func)
async def wrapper(*args, **kwargs):
for retry in range(MAX_RETRIES):
Expand All @@ -19,9 +21,11 @@ async def wrapper(*args, **kwargs):
except httpx.HTTPStatusError as e:
if e.response.status_code != 502 or retry == MAX_RETRIES - 1:
raise
await asyncio.sleep(BACKOFF_FACTOR * (2 ** retry))
await asyncio.sleep(BACKOFF_FACTOR * (2**retry))

return wrapper
else:

@wraps(func)
def wrapper(*args, **kwargs):
for retry in range(MAX_RETRIES):
Expand All @@ -30,9 +34,9 @@ def wrapper(*args, **kwargs):
except httpx.HTTPStatusError as e:
if e.response.status_code != 502 or retry == MAX_RETRIES - 1:
raise
time.sleep(BACKOFF_FACTOR * (2 ** retry))
return wrapper
time.sleep(BACKOFF_FACTOR * (2**retry))

return wrapper


class HTTPClient:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "parea-ai"
packages = [{ include = "parea" }]
version = "0.2.34"
version = "0.2.35"
description = "Parea python sdk"
readme = "README.md"
authors = ["joel-parea-ai <[email protected]>"]
Expand Down

0 comments on commit feda0f2

Please sign in to comment.