�
K�g.T � � � d dl mZ d dlZd dlmZmZmZ d dlZddlm Z ddl
mZ ddlm
Z
dd gZ G d
� d� � Z G d� d ej eef � � ZdS )� )�annotationsN)�parse_qs�unquote� urlencode� )�QueryParamTypes)�urlparse��primitive_value_to_str�URL�QueryParamsc � � e Zd ZdZd2d3d �Zed4d�� � Zed5d
�� � Zed5d�� � Zed4d�� � Z ed4d�� � Z
ed4d�� � Zed5d�� � Zed6d�� � Z
ed5d�� � Zed4d�� � Zed5d�� � Zed7d�� � Zed5d�� � Zed4d�� � Zed8d�� � Zed8d�� � Zd9d�Zd:d;d#�Zd:d;d$�Zd<d%�Zd=d(�Zd>d)�Zd?d+�Zd@d-�Zd4d.�Zd4d/�ZedAd1�� � Z d S )Br u(
url = httpx.URL("HTTPS://jo%40email.com:a%20secret@müller.de:1234/pa%20th?search=ab#anchorlink")
assert url.scheme == "https"
assert url.username == "jo@email.com"
assert url.password == "a secret"
assert url.userinfo == b"jo%40email.com:a%20secret"
assert url.host == "müller.de"
assert url.raw_host == b"xn--mller-kva.de"
assert url.port == 1234
assert url.netloc == b"xn--mller-kva.de:1234"
assert url.path == "/pa th"
assert url.query == b"?search=ab"
assert url.raw_path == b"/pa%20th?search=ab"
assert url.fragment == "anchorlink"
The components of a URL are broken down like this:
https://jo%40email.com:a%20secret@müller.de:1234/pa%20th?search=ab#anchorlink
[scheme] [ username ] [password] [ host ][port][ path ] [ query ] [fragment]
[ userinfo ] [ netloc ][ raw_path ]
Note that:
* `url.scheme` is normalized to always be lowercased.
* `url.host` is normalized to always be lowercased. Internationalized domain
names are represented in unicode, without IDNA encoding applied. For instance:
url = httpx.URL("http://中国.icom.museum")
assert url.host == "中国.icom.museum"
url = httpx.URL("http://xn--fiqs8s.icom.museum")
assert url.host == "中国.icom.museum"
* `url.raw_host` is normalized to always be lowercased, and is IDNA encoded.
url = httpx.URL("http://中国.icom.museum")
assert url.raw_host == b"xn--fiqs8s.icom.museum"
url = httpx.URL("http://xn--fiqs8s.icom.museum")
assert url.raw_host == b"xn--fiqs8s.icom.museum"
* `url.port` is either None or an integer. URLs that include the default port for
"http", "https", "ws", "wss", and "ftp" schemes have their port
normalized to `None`.
assert httpx.URL("http://example.com") == httpx.URL("http://example.com:80")
assert httpx.URL("http://example.com").port is None
assert httpx.URL("http://example.com:80").port is None
* `url.userinfo` is raw bytes, without URL escaping. Usually you'll want to work
with `url.username` and `url.password` instead, which handle the URL escaping.
* `url.raw_path` is raw bytes of both the path and query, without URL escaping.
This portion is used as the target when constructing HTTP requests. Usually you'll
want to work with `url.path` instead.
* `url.query` is raw bytes, without URL escaping. A URL query string portion can
only be properly URL escaped when decoding the parameter names and values
themselves.
� �url� URL | str�kwargs�
typing.Any�return�Nonec
�l � |�r9t t t t t t t t t t t t d�}|� � � D ]�\ }}||vr|�d�}t |� � �|�Qt
||| � � s;|| j }t |� � j }d|�d|� d|� �}t |� � �t
|t � � r|� d� � ||<