Skip to content
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

[QUESTION] : Move to a single http request library #416

Open
baseplate-admin opened this issue Jan 19, 2023 · 5 comments
Open

[QUESTION] : Move to a single http request library #416

baseplate-admin opened this issue Jan 19, 2023 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@baseplate-admin
Copy link
Contributor

Hi there,

It seems that you guys are using both requests and aiohttp to perform HTTP Request. Can we switch to httpx ? It has requests compatibility and a similar interface like aiohttp

We can probably remove this file :

async def get(url, headers=None):
"""
Send REST get request to the url passed in
:param url: The Url to get call get request on
:param headers: The headers to pass with the get request
:return: data if any exists
"""
if headers is None:
headers = {}
try:
async with aiohttp.ClientSession() as session:
async with session.get(url, headers=headers) as response:
text = await response.read()
return text
except Exception as e:
logger.error(f"Error in get request: {e}")

@baseplate-admin baseplate-admin added the question Further information is requested label Jan 19, 2023
@fakeid30
Copy link
Collaborator

@cullzie what do you think?

@baseplate-admin
Copy link
Contributor Author

This is not a good take on this issue as cloudscraper internally uses requests and requests-toolbelt and so including httpx will introduce yet another HTTP Client library ( which we are trying to avoid )

@baseplate-admin
Copy link
Contributor Author

I have another proposal to move everything to requests.

@cullzie what do you think ?

@cullzie
Copy link
Collaborator

cullzie commented Mar 7, 2023

Hey @baseplate-admin,
The cloudscraper dependency is the only reason we have both requests and aiohttp.
I would be happy to have a look at your proposal on this

@baseplate-admin
Copy link
Contributor Author

baseplate-admin commented Oct 29, 2023

It's been a couple of months.

So here's my take on this issue,

It's tiresome to wait for aiohttp to bump their dependencies every major python upgrade.

So, here are my proposals :

  1. My first proposal is to move everything to httpx. It has a synchronous ( and on demand asynchronous ) api that would suffice our needs pretty well.

  2. My second proposal is that, we dont use aiohttp and use requests for everything. The requests ecosystem is amazing and faster-cpython project willl only increase the performance of requests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants