Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ True
```

* `def __init__(url)`
* `.scheme` - **str**
* `.is_ssl` - **bool**
* `.host` - **str**
* `.port` - **int**
Expand Down
6 changes: 2 additions & 4 deletions httpx/dispatch/connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ class ConnectionStore:
"""

def __init__(self) -> None:
self.all = {} # type: typing.Dict[HTTPConnection, float]
self.by_origin = (
{}
) # type: typing.Dict[Origin, typing.Dict[HTTPConnection, float]]
self.all: typing.Dict[HTTPConnection, float] = {}
self.by_origin: typing.Dict[Origin, typing.Dict[HTTPConnection, float]] = {}

def pop_by_origin(
self, origin: Origin, http2_only: bool = False
Expand Down
5 changes: 3 additions & 2 deletions httpx/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,21 @@ class Origin:
def __init__(self, url: URLTypes) -> None:
if not isinstance(url, URL):
url = URL(url)
self.scheme = url.scheme
self.is_ssl = url.is_ssl
self.host = url.host
self.port = url.port

def __eq__(self, other: typing.Any) -> bool:
return (
isinstance(other, self.__class__)
and self.is_ssl == other.is_ssl
and self.scheme == other.scheme
and self.host == other.host
and self.port == other.port
)

def __hash__(self) -> int:
return hash((self.is_ssl, self.host, self.port))
return hash((self.scheme, self.host, self.port))


class QueryParams(typing.Mapping[str, str]):
Expand Down