-
Hi! Thanks for your amazing work import asyncio
from datetime import timedelta
import httpx
import stamina
class GoogleClient:
@classmethod
@stamina.retry(
on=httpx.HTTPError, attempts=3, timeout=timedelta(seconds=10)
)
async def get_google(cls):
async with httpx.AsyncClient() as client:
response = await client.get("https://www.google.com")
return response
result = asyncio.run(GoogleClient.get_google())
print(result.content) this works well, is this a right way to use stamina with @classmethod? |
Beta Was this translation helpful? Give feedback.
Answered by
hynek
Nov 23, 2023
Replies: 1 comment 1 reply
-
Is there a reason for you to think it's not? Stamina shouldn't care about the type of the type of the callable it's wrapping so I think so? If you run into any problems or interesting effects, please do let me know. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
triumph1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a reason for you to think it's not? Stamina shouldn't care about the type of the type of the callable it's wrapping so I think so? If you run into any problems or interesting effects, please do let me know.