Skip to content

3 http client - #8

Merged
Moasib-Arif merged 12 commits into
mainfrom
3-HTTP-Client
Jan 17, 2024
Merged

3 http client#8
Moasib-Arif merged 12 commits into
mainfrom
3-HTTP-Client

Conversation

@Moasib-Arif

Copy link
Copy Markdown
Contributor

Created a HTTP Client that can send get() and post() requests using the python httpclient library.

Changes:

  • Implemented get, post and request methods in the http
  • Implemented exponential backoff (it will retry when request fails)
  • Added test coverage for methods, backoff and proprogate kwargs

@mikeAdamssmikeAdamss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the timout aspects of this are getting nasty, bad steer from me, hard to change the timeout when its in the decorator not the class.

for now - just use backoff_max from the instantiation for max_time in the decorator and lose the kwarg approach. That should greatly simplify it. It someone really needs to send two requests with different timeouts from the same app they'll just have to reinstantiate the client (its not a super likely scenario).

I can see why you've gone with urllib here (factor things out) btw but I'd be tempted to see how it looks with requests, its very batteries included and simple. If its more verbose but the code is simpler that's ok.

Last thing, be sure to try the client a bit in anger 😄 , I think the kwarg propogation is off a bit at the moment and it;'d be really obvious if you play around with this a bit, i.e

from dpytools.http_clients.http_custom import HttpClient
client = HttpClient()
client.get("") # <--- try some actual urls, some that work, some that dont. check you're getting those retry logs etc.

Comment threaddpytools/http_clients/http_custom.py Outdated
Comment threaddpytools/http_clients/http_custom.py Outdated
Comment threadtests/test_http.py Outdated
Comment threaddpytools/http_clients/http_custom.py Outdated
Comment threaddpytools/http_clients/http_custom.py Outdated
@mikeAdamssmikeAdamss linked an issue Jan 14, 2024 that may be closed by this pull request
3 tasks
@Moasib-Arif
Moasib-Arif marked this pull request as ready for review January 15, 2024 09:34

@mikeAdamssmikeAdamss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor tidyup changes only

Comment threaddpytools/http_clients/base.py
Comment threaddpytools/http_clients/base.py
Comment threaddpytools/http_clients/base.py Outdated
Comment threaddpytools/http_clients/base.py Outdated
Comment threaddpytools/http_clients/base.py Outdated

@mikeAdamssmikeAdamss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@Moasib-Arif
Moasib-Arif merged commit 00c29ea into mainJan 17, 2024
Sign up for freeto 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.

implement backoff enabled http client

2 participants

@Moasib-Arif@mikeAdamss