-
Notifications
You must be signed in to change notification settings - Fork 28
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
Feature request: make HTTP library pluggable #218
Comments
Hello there, Sorry to barge in, This is a drop-in-worthy replacement for Requests that ships with modern capabilities and allows you a painless transition. |
The singular instance is here: Lines 129 to 143 in 8f72a81
Here's what you'd currently have to use to leverage a different library: import httpx
url = "https://example.com"
mf2py.parse(httpx.get(url), url=url) Here's what we could do: import httpx
mf2py.parse(url="https://example.com", url_fetcher=httpx) This would work with anything that emulates the import niquests
mf2py.parse(url="https://example.com", url_fetcher=niquests) This would also enable session support which is something I've wanted before and may prove to be more useful as protected posts proliferate: import requests
session = requests.Session()
session.auth = ('user', 'pass')
mf2py.parse(url="https://example.com", url_fetcher=session) Choices for the keyword argument are |
I was looking through the code for mf2py the other day and realised we boil requests in as a dependency. httpx exists and it's pretty good (async, http2, etc). Might be useful if we could make it support httpx as well as requests and reconsider requests as default. There are a few differences that are documented.
The text was updated successfully, but these errors were encountered: