Skip to content

Conversation

@JahongirHakimjonov
Copy link

This pull request refactors both the synchronous and asynchronous HTTP client implementations to use httpx instead of requests, introduces global reusable HTTP client instances for efficiency, and improves error handling in the async client. It also fixes a typo in a class name and updates dependencies accordingly.

HTTP client refactoring and improvements:

  • Replaced requests with httpx in the synchronous HTTP client (click_up/classes/http.py), introducing a global reusable httpx.Client with HTTP/2 support and automatic retries.
  • Updated the post method to use the new httpx.Client and its .post() method for sending requests.
  • Refactored the asynchronous HTTP client (clickup_fastapi/core/http.py) to use a global reusable httpx.AsyncClient with HTTP/2 and retries, and improved header merging.

Error handling:

  • Enhanced error handling in the async HTTP client's post method to return structured error responses for both HTTP errors and network issues.

Dependency updates and typo fix:

  • Replaced the requests dependency with httpx[http2] in requirements.txt.
  • Fixed a typo in the class name ClickShopApiRespone to ClickShopApiResponse in click_up/typing/response/shop_api.py.

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.

1 participant