Comments (8)
If we do keep it as a URL instance, then one option to keep closer API compat would be to allow string comparisons, eg URL(“https://www.encode.io/“) == “https://www.encode.io/“
That has the advantage of being string-like, and far less likely to introduce any API breakage.
from httpx.
Seems like it's probably the best all round option yeah.
from httpx.
I'm for allowing string comparisons and providing the read-only URL instance. :) Seems like something users are probably doing themselves and shouldn't have to.
from httpx.
how about:
with http3.Session(requests_compat=True) as s:
assert type(s.get("https://example.com").url) is str
from httpx.
I'd say that flags / parameters that massively alter the behavior of a function should probably be avoided.
Typically what a lot of URL instance classes do to recover the original string for the URL is provide an .unsplit()
method.
from httpx.
How about instead of maintaining backwards compatibility with requests, provide a series of codemods so people can upgrade their code to the new api?
from httpx.
We'll definitely need a section in the documentation on migration strategy, especially from requests but also useful to how for instance urllib3 does something compared to http3.
from httpx.
Personally I am quite in favor of the URL
class, and am currently using urlpath for approximately the same function, including the ability to concatenate parts with /
. Making URL
instances string comparable (and bonus: /
concat-able!) would be the best option I think, giving the best of both worlds.
from httpx.
Related Issues (20)
- add more type checking in params/form-data HOT 12
- Requests for new public APIs HOT 9
- Install httpx without pulling anyio, trio and socks HOT 1
- Pressure test httpx Slower and slower HOT 4
- 502 Error When Using Global Proxy
- Shipping broken. "Could not find module httpx" even when installed.
- Authentification docs reference non-existing class HOT 2
- `httpx.AsyncClient` has much worse performance than `aiohttp.ClientSession` with concurrent requests HOT 22
- HTTPX and Celery \ GEvent Issue HOT 3
- Not support "no_proxy" including value of ipv6 prefix style
- http2协议发送请求会发送两次,第一次数据,第二次空包End Stream,如何将第二次空包的End Stream放到第一次包中
- Support IDNA2003 HOT 2
- How to implement failed retry
- BasicAuth vs BasicAuthentication HOT 2
- Httpx connection Nonetype error
- Change default encoding to utf-8 in `normalize_header_key` and `normalize_header_value` functions HOT 4
- httpx能支持get或者post请求的时候传入代理,而不是httpx.AsyncClient初始化的时候传入吗
- Random httpx.ConnectError
- How to force enable HTTP/2.0 HOT 5
- Module 'httpx' has no attribute 'BasicAuthentication' - Documentation is not up-to-date
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httpx.