>[!CAUTION]
> **This package is no longer maintained and replaced with [httpc](https://github.com/ilotoki0804/httpc).**
# hxsoup
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hxsoup)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/hxsoup)](https://pypi.org/project/hxsoup)
**Various convenient features related to httpx and BeautifulSoup.** (<span style="color:blue">**h**</span>ttp<span style="color:blue">**x**</span> + Beautiful<span style="color:blue">**Soup**</span>)
hxsoup는 httpx를 기반으로 추가적인 기능을 추가한 라이브러리입니다.
## Getting started
파이썬을 설치하고 터미널에 다음과 같은 명령어를 입력하세요.
```console
pip install -U hxsoup
```
httpx와 bs4는 같이 설치되지만 BeatifulSoup의 추가적인 parser인 lxml와 html5lib는 기본으로 제공하지 않습니다.
## How to use
> [!NOTE]
> 예시에서는 get 요청을 위주로 설명하지만, 다른 모든 메소드(options/head/post/put/patch/delete)에서도 동일하게 작동합니다.
### attempts
어떤 경우에서든 서버와의 연결이 실패할 수 있습니다. 이유는 다양할 수 있으나, 그저 다시 시도하는 것만으로도 해결되는 경우가 태반입니다.
만약 attempts를 1보다 큰 정수로 설정하면 연결을 실패했을 때 해당 숫자만큼 재시도합니다. 그리고 만약 결국 attempts 만큼 도전했는데도 불구하고 연결에 실패했을 경우 오류를 re-raise합니다.
연결에 바로 성공했을 경우:
```python
>>> import hxsoup.dev as hd
>>> hd.get("https://python.org", attempts=3)
<Response [200 OK]>
```
> [!NOTE]
> `hxsoup.dev`는 hxsoup와 거의 같지만 일부 기본값을 조정한 모듈입니다. hxsoup와 같다고 생각하셔도 무관합니다.
> 자세한 내용은 뒤에서 설명합니다.
연결에 끝까지 실패했을 경우:
```python
>>> import hxsoup.dev as hd
>>> hd.get("https://unreachable-service.com", attempts=3)
WARNING:root:Retrying...
WARNING:root:Retrying...
Traceback (most recent call last):
...
httpx.ConnectError: [Errno 11001] getaddrinfo failed
```
첫 연결에 실패하고 다시 몇 번 시도했을 때 성공했을 경우:
```python
>>> import hxsoup.dev as hd
>>> hd.get('https://www.webtoons.com/en/', attempts=4)
WARNING:root:Retrying...
WARNING:root:Retrying...
WARNING:root:Successfully retrieved: 'https://www.webtoons.com/en/'
<Response [200 OK]>
```
### raise_for_status
httpx에는 raise_for_status라는 기능이 있습니다.
`response.raise_for_status()`를 이용하면 상태 코드가 일반적이지 않을 때 오류를 냅니다.
```python
>>> import hxsoup.dev as hd
>>> response = hd.get("https://httpbin.org/status/404")
>>> response.raise_for_status()
Traceback (most recent call last):
...
httpx.HTTPStatusError: Client error '404 NOT FOUND' for url 'https://httpbin.org/status/404'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
```
hxsoup에서는 `raise_for_status`를 파라미터에서 그대로 사용할 수 있도록 합니다.
```python
>>> import hxsoup.dev as hd
>>> response = hd.get("https://httpbin.org/status/404", raise_for_status=True)
Traceback (most recent call last):
...
httpx.HTTPStatusError: Client error '404 NOT FOUND' for url 'https://httpbin.org/status/404'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
```
Client에 `raise_for_status`를 추가하면 해당 클라이언트에서는 모두 raise_for_status가 적용됩니다.
```python
>>> import hxsoup.dev as hd
>>> with hd.Client(raise_for_status=True) as client:
... try:
... client.get("https://httpbin.org/status/404")
... except Exception as e:
... print(e)
... try:
... client.get("https://httpbin.org/status/404")
... except Exception as e:
... print(e)
...
Client error '404 NOT FOUND' for url 'https://httpbin.org/status/404'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
Client error '404 NOT FOUND' for url 'https://httpbin.org/status/404'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
```
일반적으로 상태 코드 이상은 모든 연결이 안정적으로 동작한 경우가 많기 때문에 raise_for_status에 의한 오류는 attempts에 의해 필터링되지 않습니다.
### Client
hxsoup.Client는 httpx.Client에 대응하는 기능입니다. 위에서 설명되었던 모든 추가 파라미터들(attempts, raise_for_status)는 Client에서도 사용할 수 있으며 Client를 initialize할 때 사용한다면 해당 client의 모든 통신에서 적용시킬 수 있습니다.
```python
>>> with hxsoup.Client(raise_for_status=True) as client:
... # Client를 initialize할 때 raise_for_status를 True로 했기 때문에
... # raise_for_status를 직접 적지 않았다면 raise_for_status가 자동을 적용됨.
... client.get("https://httpbin.org/status/404")
...
Traceback (most recent call last):
...
httpx.HTTPStatusError: Client error '404 NOT FOUND' for url 'https://httpbin.org/status/404'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
```
하지만 개별 request에 해당 파라미터와 다른 파라미터를 적용했다면 해당 파라미터가 적용됩니다.
### SoupTools, SoupedResponse
`SoupTools`는 `BeautifulSoup`에 몇 가지 편리한 기능을 추가하고,
`SoupedResponse`는 `BeautifulSoup`를 respone 안에 멋지게 통합합니다.
`SoupedResponse`는 `httpx.Response`의 subclass이면서 `SoupTools`의 subclass이며,
hxsoup.dev를 포함하여 hxsoup의 모든 response는 SoupedResponse입니다.
#### The `SoupTools` methods that correspond to methods in BeautifulSoup
`SoupTools`에는 BeautifulSoup의 메소드에 대응하는 메소드들이 있습니다.
* `SoupTools.soup()`: `BeautifulSoup(...)`에 대응합니다.
* `SoupTools.soup_select(selector)`: `BeautifulSoup(...).select(selector)`에 대응합니다.
* `SoupTools.soup_select_one(selector)`: `BeautifulSoup(...).select_one(selector)`에 대응합니다.
#### `no_empty_result`
`BeautifulSoup.soup_select_one()`에는 한 가지 문제가 있습니다. 바로 해당하는 element를 찾는데 실패했을 때 오류가 아닌 None을 내밷는다는 점입니다. 이는 어쩔 때는 편리할지는 몰라도 typing도 어렵고 `.soup_select().text`와 같은 chaining도 어렵게 합니다.
hxsoup의 `response.soup_select_one()`에는 이러한 문제를 해결하기 위해 `no_empty_result`라는 파라미터를 도입했습니다.
아래는 `python.org`에 `never-gonna-selected`라는 선택자에 맞는 태그가 있는지 확인하고 있습니다. `python.org`에서는 그런 태그는 없기 때문에 일반적으로는 None을 반환받게 되는데, `no_empty_result`가 True라면 None이 아닌 오류를 raise하게 됩니다.
```python
>>> import hxsoup.dev as hd
>>> res = hd.get("https://python.org")
>>> res.soup_select_one("never-gonna-selected", no_empty_result=True)
Traceback (most recent call last):
...
hxsoup.exceptions.EmptyResultError: Selecting result is None. This error happens probably because of invalid selector or URL. Check whether selector and URL are both valid.
status code: HTTP 200 OK, URL: https://www.python.org/, selector: 'never-gonna-selected'
```
같은 방식이 response.soup_select()에도 적용됩니다. 이 경우 빈 리스트가 리턴될 때 EmptyResultError가 나게 됩니다.
```python
>>> import hxsoup.dev as hd
>>> res = hd.get("https://python.org")
>>> res.soup_select("never-gonna-selected", no_empty_result=True)
Traceback (most recent call last):
...
hxsoup.exceptions.EmptyResultError: Selecting result is empty list("[]"). This error happens probably because of invalid selector or URL. Check whether selector and URL are both valid.
status code: HTTP 200 OK, URL: https://www.python.org/, selector: 'never-gonna-selected'
```
`response.soup_select()`에도 `no_empty_result`가 있다는 점을 잊지 마세요. 따라서 `Client`나 `hxsoup.get` 자체에 `no_empty_result`를 사용할 때에는 이 기능이 `response.soup_select()`에도 적용된다는 점을 명심하세요.
#### `parser`
parser을 설정할 수 있도록 합니다. BeautifulSoup의 용어로는 `feature`입니다.
기본적으로는 `'html.parser'`를 사용하도록 되어 있습니다.
#### Broadcasting
`soup_select()`의 결과는 리스트입니다. Tag 관련 처리를 할 때에는 리스트 컴프리헨션을 이용해야 하는데, 여간 귀찮은 일이 아닙니다.
hxsoup에서 `soup_select()`의 결과는 BroadcastList이며, 이는 여러 문제를 해결합니다.
BroadcastList는 `.bc`를 붙이면 브로드캐스팅 가능한 상황이 되고 그 뒤에 어떤 것을 붙이던 브로드캐스팅이 일어납니다.
예를 들면 다음의 코드는
```python
>>> import hxsoup.dev as hd
>>> res = hd.get("https://python.org")
>>> [tag.text for tag in res.soup_select("strong")]
['Notice:', 'A A', 'relaunched community-run job board']
```
아래의 코드로 대체될 수 있습니다.
```python
>>> import hxsoup.dev as hd
>>> res = hd.get("https://python.org")
>>> res.soup_select("strong").bc.text
['Notice:', 'A A', 'relaunched community-run job board']
```
브로드캐스팅을 더 하고 싶다면 `.bc`를 또 붙이면 됩니다.
```python
>>> import hxsoup.dev as hd
>>> res = hd.get("https://python.org")
>>> res.soup_select("strong").bc.text.bc[::2]
['Ntc:', 'AA', 'rluce omnt-u o or']
```
### ClientOptions
고정적으로 여러 request에 대해 같은 키워드를 사용해야 하는 경우가 있습니다. 대부분은 Client를 이용하면 해결되지만, AsyncClient와 Client를 같이 사용하거나, httpx.get처럼 클라이언트 없이 사용하고 싶은 경우도 있을 것입니다. 이럴 경우 이 클래스를 사용할 수 있습니다.
```python
(.venv) C:\Users\USER\Programming\vscode\git\hxsoup>py -3.12 -m asyncio
asyncio REPL 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> from hxsoup import ClientOptions
>>>
>>> options = ClientOptions(follow_redirects=True)
>>> print(options.get("https://python.org"))
<Response [200 OK]>
>>> with options.build_client() as client:
... print(client.get("https://python.org"))
...
<Response [200 OK]>
>>> async with options.build_async_client() as async_client:
... print(await client.get("https://python.org"))
...
<Response [200 OK]>
```
### `hxsoup.dev`
일부 기본값을 재조정하고 caching이 포함된 모듈입니다.
#### Adjusted defaults
개발 중에는 일부 파라미터가 흔히 많이 사용됩니다. 예를 들어 `follow_redirects` 파라미터는 httpx에서 기본적으로 꺼져 있지만 이른 개발 사이클에 있는 경우 켜져 있는 것이 편한 경우가 많습니다.
개발자의 편의를 위해 `follow_redirects`를 비롯한 몇몇 파라미터들은 httpx의 기본 설정값과는 다른 값을 이용합니다.
| 파라미터 이름 | hxsoup 기본값 | `hxsoup.dev` 기본값 |
|--------------|--------------|---------------------|
| `follow_redirects` | False | True |
| `headers` | None | `DEV_HEADERS` |
```python
>>> import hxsoup
>>> hxsoup.get("https://python.org")
<Response [301 Moved Permanently]>
>>>
>>> import hxsoup.dev as hd
>>> # follow_redirects가 True임.
>>> hd.get("https://python.org")
<Response [200 OK]>
```
`DEV_HEADERS`의 내용은 Chrome 브라우저의 기본 헤더이며 내용은 다음과 같습니다.
```python
{
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7",
"Sec-Ch-Ua": '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
"Sec-Ch-Ua-Arch": '"x86"',
"Sec-Ch-Ua-Bitness": '"64"',
"Sec-Ch-Ua-Full-Version-List": '"Not_A Brand";v="8.0.0.0", "Chromium";v="120.0.6099.130", "Google Chrome";v="120.0.6099.130"',
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Model": '""',
"Sec-Ch-Ua-Platform": '"Windows"',
"Sec-Ch-Ua-Platform-Version": '"15.0.0"',
"Sec-Ch-Ua-Wow64": "?0",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "none",
"Sec-Fetch-User": "?1",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
}
```
#### cached requests
활발한 개발 중에는, 특히 Jupyter를 이용할 때는, 일부 requests를 계속해서 보내게 되는 경우가 있습니다. 이는 서버에 부담을 주고 개발 속도를 늦춥니다.
각 메소드의 앞에 c를 붙이면 응답이 캐싱됩니다.
예를 들어 시간을 비교하면 아래와 같이 됩니다.
```python
>>> from timeit import timeit
>>> timeit('hd.get("https://python.org")', setup="import hxsoup.dev as hd", number=10)
0.7851526000013109
>>> timeit('hd.cget("https://python.org")', setup="import hxsoup.dev as hd", number=10)
0.061434000002918765
```
options/head/post/put/patch/delete들도 마찬가지로 대응되는 coptions/chead/cpost/cput/cpatch/cdelete가 있습니다.
```python
>>> from timeit import timeit
>>> timeit('hd.post("https://httpbin.org/post")', setup="import hxsoup.dev as hd", number=10)
9.307660000005853
>>> timeit('hd.cpost("https://httpbin.org/post")', setup="import hxsoup.dev as hd", number=10)
0.8557240999944042
```
캐시는 lru_cache 기본값을 사용하기 때문에 메소드 구분 없이 128개까지 저장됩니다.
#### Client/ClientOptions
Client와 ClientOptions에도 마찬가지로 기본 옵션을 사용 가능합니다.
```python
>>> import hxsoup.dev as hd
>>> import hxsoup
>>>
>>> client = hxsoup.Client()
>>> client.get("https://python.org")
<Response [301 Moved Permanently]>
>>>
>>> dev_client = hd.Client()
>>> dev_client.get("https://python.org")
<Response [200 OK]>
>>>
>>> options = hxsoup.ClientOptions()
>>> options.get("https://python.org")
<Response [301 Moved Permanently]>
>>>
>>> dev_options = hd.ClientOptions()
>>> dev_options.get("https://python.org")
<Response [200 OK]>
```
## License information
이 프로그램의 일부는 [resoup(본인 제작)](https://github.com/ilotoki0804/resoup) 라이브러리에 있던 코드를 포함합니다.
Some part of this program contains code from [resoup(created and developed by me)](https://github.com/ilotoki0804/resoup) library.
이 프로그램의 일부는 [httpx(BSD-3-Clause license)](https://github.com/encode/httpx) 라이브러리에 있던 코드를 포함합니다.
Some part of this program contains code from [httpx](https://github.com/encode/httpx) library.
## Motivation and blathers
이전에 requests의 불편한 점을 느끼고 관련 내용을 입맛에 맞게 수정한 resoup라는 라이브러리를 만들어 사용하고 있었습니다.
그러던 어느 날 [ArjanCodes의 영상](https://www.youtube.com/watch?v=OPyoXx0yA0I)에서 httpx에 대해 다시 보게 되고 실제로 사용해보니 requests와 상위 호환되는 라이브러리라는 점을 알게 되었습니다.
따라서 httpx을 앞으로의 프로젝트들에서 사용하기로 결정했고, resoup의 기능을 포기할 수 없었기에 requests의 경우와 마찬가지로 resoup에 대응하는 httpx에 대한 유틸리티를 만들기로 했으며 그 결과가 hxsoup입니다.
resoup과 비교했을 때 개발 경험은 hxsoup 쪽이 압도적으로 좋았는데, requests는 type hint가 나오기 전 라이브러리라 그런지 효율적이지만 type hint를 적용하기에는 최악이었던 반면, httpx는 따로 type stub나 typing.overload를 거의 사용하지 않았을 정도로 매우 안정적이고 typing을 적용하면서 개발하기에도 좋았습니다. (물론 resoup을 만들면서 생긴 노하우도 많이 도움이 되었겠지만요.)
## Changelog
* 0.5.1 (2024-10-02): 빌드 시스템에 uv 사용, attempt 대상에 SSLError도 추가
* 0.5.0 (2024-06-22): logger 사용, 빌드 현대화, 의존성 업그레이드, 기타 문서 및 코드 개선
* 0.4.1 (2024-01-24): caching 제거, broadcasting 마저 제거.
* 0.4.0 (2024-01-23): NotEmptySoupTools와 NotEmptySoupedResponse 추가, soup_select와 soup_select_one에 **kwargs 추가, 버그 수정
* 0.3.0 (2024-01-04): ClientOptions 추가, 코드 및 버그 수정
* 0.2.0 (2024-01-01): 여러 기능을 추가하고 수정.
* 0.1.0 (2023-12-28): 첫 (프리)릴리즈
Raw data
{
"_id": null,
"home_page": null,
"name": "hxsoup",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "beautifulsoup, beautifulsoup4, bs4, httpx, request, soup",
"author": null,
"author_email": "ilotoki0804 <ilotoki0804@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/24/2a/3a62d01d892ae80216dbbd4d8084f5833843f50fb1e6d4094ecf05660b22/hxsoup-0.6.0.tar.gz",
"platform": null,
"description": ">[!CAUTION]\n> **This package is no longer maintained and replaced with [httpc](https://github.com/ilotoki0804/httpc).**\n\n# hxsoup\n\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hxsoup)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/hxsoup)](https://pypi.org/project/hxsoup)\n\n**Various convenient features related to httpx and BeautifulSoup.** (<span style=\"color:blue\">**h**</span>ttp<span style=\"color:blue\">**x**</span> + Beautiful<span style=\"color:blue\">**Soup**</span>)\n\nhxsoup\ub294 httpx\ub97c \uae30\ubc18\uc73c\ub85c \ucd94\uac00\uc801\uc778 \uae30\ub2a5\uc744 \ucd94\uac00\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac\uc785\ub2c8\ub2e4.\n\n## Getting started\n\n\ud30c\uc774\uc36c\uc744 \uc124\uce58\ud558\uace0 \ud130\ubbf8\ub110\uc5d0 \ub2e4\uc74c\uacfc \uac19\uc740 \uba85\ub839\uc5b4\ub97c \uc785\ub825\ud558\uc138\uc694.\n\n```console\npip install -U hxsoup\n```\n\nhttpx\uc640 bs4\ub294 \uac19\uc774 \uc124\uce58\ub418\uc9c0\ub9cc BeatifulSoup\uc758 \ucd94\uac00\uc801\uc778 parser\uc778 lxml\uc640 html5lib\ub294 \uae30\ubcf8\uc73c\ub85c \uc81c\uacf5\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.\n\n## How to use\n\n> [!NOTE]\n> \uc608\uc2dc\uc5d0\uc11c\ub294 get \uc694\uccad\uc744 \uc704\uc8fc\ub85c \uc124\uba85\ud558\uc9c0\ub9cc, \ub2e4\ub978 \ubaa8\ub4e0 \uba54\uc18c\ub4dc(options/head/post/put/patch/delete)\uc5d0\uc11c\ub3c4 \ub3d9\uc77c\ud558\uac8c \uc791\ub3d9\ud569\ub2c8\ub2e4.\n\n### attempts\n\n\uc5b4\ub5a4 \uacbd\uc6b0\uc5d0\uc11c\ub4e0 \uc11c\ubc84\uc640\uc758 \uc5f0\uacb0\uc774 \uc2e4\ud328\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774\uc720\ub294 \ub2e4\uc591\ud560 \uc218 \uc788\uc73c\ub098, \uadf8\uc800 \ub2e4\uc2dc \uc2dc\ub3c4\ud558\ub294 \uac83\ub9cc\uc73c\ub85c\ub3c4 \ud574\uacb0\ub418\ub294 \uacbd\uc6b0\uac00 \ud0dc\ubc18\uc785\ub2c8\ub2e4.\n\n\ub9cc\uc57d attempts\ub97c 1\ubcf4\ub2e4 \ud070 \uc815\uc218\ub85c \uc124\uc815\ud558\uba74 \uc5f0\uacb0\uc744 \uc2e4\ud328\ud588\uc744 \ub54c \ud574\ub2f9 \uc22b\uc790\ub9cc\ud07c \uc7ac\uc2dc\ub3c4\ud569\ub2c8\ub2e4. \uadf8\ub9ac\uace0 \ub9cc\uc57d \uacb0\uad6d attempts \ub9cc\ud07c \ub3c4\uc804\ud588\ub294\ub370\ub3c4 \ubd88\uad6c\ud558\uace0 \uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud588\uc744 \uacbd\uc6b0 \uc624\ub958\ub97c re-raise\ud569\ub2c8\ub2e4.\n\n\uc5f0\uacb0\uc5d0 \ubc14\ub85c \uc131\uacf5\ud588\uc744 \uacbd\uc6b0:\n\n```python\n>>> import hxsoup.dev as hd\n>>> hd.get(\"https://python.org\", attempts=3)\n<Response [200 OK]>\n```\n\n> [!NOTE]\n> `hxsoup.dev`\ub294 hxsoup\uc640 \uac70\uc758 \uac19\uc9c0\ub9cc \uc77c\ubd80 \uae30\ubcf8\uac12\uc744 \uc870\uc815\ud55c \ubaa8\ub4c8\uc785\ub2c8\ub2e4. hxsoup\uc640 \uac19\ub2e4\uace0 \uc0dd\uac01\ud558\uc154\ub3c4 \ubb34\uad00\ud569\ub2c8\ub2e4.\n> \uc790\uc138\ud55c \ub0b4\uc6a9\uc740 \ub4a4\uc5d0\uc11c \uc124\uba85\ud569\ub2c8\ub2e4.\n\n\uc5f0\uacb0\uc5d0 \ub05d\uae4c\uc9c0 \uc2e4\ud328\ud588\uc744 \uacbd\uc6b0:\n\n```python\n>>> import hxsoup.dev as hd\n>>> hd.get(\"https://unreachable-service.com\", attempts=3)\nWARNING:root:Retrying...\nWARNING:root:Retrying...\nTraceback (most recent call last):\n ...\nhttpx.ConnectError: [Errno 11001] getaddrinfo failed\n```\n\n\uccab \uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud558\uace0 \ub2e4\uc2dc \uba87 \ubc88 \uc2dc\ub3c4\ud588\uc744 \ub54c \uc131\uacf5\ud588\uc744 \uacbd\uc6b0:\n\n```python\n>>> import hxsoup.dev as hd\n>>> hd.get('https://www.webtoons.com/en/', attempts=4)\nWARNING:root:Retrying...\nWARNING:root:Retrying...\nWARNING:root:Successfully retrieved: 'https://www.webtoons.com/en/'\n<Response [200 OK]>\n```\n\n### raise_for_status\n\nhttpx\uc5d0\ub294 raise_for_status\ub77c\ub294 \uae30\ub2a5\uc774 \uc788\uc2b5\ub2c8\ub2e4.\n`response.raise_for_status()`\ub97c \uc774\uc6a9\ud558\uba74 \uc0c1\ud0dc \ucf54\ub4dc\uac00 \uc77c\ubc18\uc801\uc774\uc9c0 \uc54a\uc744 \ub54c \uc624\ub958\ub97c \ub0c5\ub2c8\ub2e4.\n\n```python\n>>> import hxsoup.dev as hd\n>>> response = hd.get(\"https://httpbin.org/status/404\")\n>>> response.raise_for_status()\nTraceback (most recent call last):\n ...\nhttpx.HTTPStatusError: Client error '404 NOT FOUND' for url 'https://httpbin.org/status/404'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404\n```\n\nhxsoup\uc5d0\uc11c\ub294 `raise_for_status`\ub97c \ud30c\ub77c\ubbf8\ud130\uc5d0\uc11c \uadf8\ub300\ub85c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub3c4\ub85d \ud569\ub2c8\ub2e4.\n\n```python\n>>> import hxsoup.dev as hd\n>>> response = hd.get(\"https://httpbin.org/status/404\", raise_for_status=True)\nTraceback (most recent call last):\n ...\nhttpx.HTTPStatusError: Client error '404 NOT FOUND' for url 'https://httpbin.org/status/404'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404\n```\n\nClient\uc5d0 `raise_for_status`\ub97c \ucd94\uac00\ud558\uba74 \ud574\ub2f9 \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0\uc11c\ub294 \ubaa8\ub450 raise_for_status\uac00 \uc801\uc6a9\ub429\ub2c8\ub2e4.\n\n```python\n>>> import hxsoup.dev as hd\n>>> with hd.Client(raise_for_status=True) as client:\n... try:\n... client.get(\"https://httpbin.org/status/404\")\n... except Exception as e:\n... print(e)\n... try:\n... client.get(\"https://httpbin.org/status/404\")\n... except Exception as e:\n... print(e)\n...\nClient error '404 NOT FOUND' for url 'https://httpbin.org/status/404'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404\nClient error '404 NOT FOUND' for url 'https://httpbin.org/status/404'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404\n```\n\n\uc77c\ubc18\uc801\uc73c\ub85c \uc0c1\ud0dc \ucf54\ub4dc \uc774\uc0c1\uc740 \ubaa8\ub4e0 \uc5f0\uacb0\uc774 \uc548\uc815\uc801\uc73c\ub85c \ub3d9\uc791\ud55c \uacbd\uc6b0\uac00 \ub9ce\uae30 \ub54c\ubb38\uc5d0 raise_for_status\uc5d0 \uc758\ud55c \uc624\ub958\ub294 attempts\uc5d0 \uc758\ud574 \ud544\ud130\ub9c1\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.\n\n### Client\n\nhxsoup.Client\ub294 httpx.Client\uc5d0 \ub300\uc751\ud558\ub294 \uae30\ub2a5\uc785\ub2c8\ub2e4. \uc704\uc5d0\uc11c \uc124\uba85\ub418\uc5c8\ub358 \ubaa8\ub4e0 \ucd94\uac00 \ud30c\ub77c\ubbf8\ud130\ub4e4(attempts, raise_for_status)\ub294 Client\uc5d0\uc11c\ub3c4 \uc0ac\uc6a9\ud560 \uc218 \uc788\uc73c\uba70 Client\ub97c initialize\ud560 \ub54c \uc0ac\uc6a9\ud55c\ub2e4\uba74 \ud574\ub2f9 client\uc758 \ubaa8\ub4e0 \ud1b5\uc2e0\uc5d0\uc11c \uc801\uc6a9\uc2dc\ud0ac \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n```python\n>>> with hxsoup.Client(raise_for_status=True) as client:\n... # Client\ub97c initialize\ud560 \ub54c raise_for_status\ub97c True\ub85c \ud588\uae30 \ub54c\ubb38\uc5d0\n... # raise_for_status\ub97c \uc9c1\uc811 \uc801\uc9c0 \uc54a\uc558\ub2e4\uba74 raise_for_status\uac00 \uc790\ub3d9\uc744 \uc801\uc6a9\ub428.\n... client.get(\"https://httpbin.org/status/404\")\n...\nTraceback (most recent call last):\n ...\nhttpx.HTTPStatusError: Client error '404 NOT FOUND' for url 'https://httpbin.org/status/404'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404\n```\n\n\ud558\uc9c0\ub9cc \uac1c\ubcc4 request\uc5d0 \ud574\ub2f9 \ud30c\ub77c\ubbf8\ud130\uc640 \ub2e4\ub978 \ud30c\ub77c\ubbf8\ud130\ub97c \uc801\uc6a9\ud588\ub2e4\uba74 \ud574\ub2f9 \ud30c\ub77c\ubbf8\ud130\uac00 \uc801\uc6a9\ub429\ub2c8\ub2e4.\n\n### SoupTools, SoupedResponse\n\n`SoupTools`\ub294 `BeautifulSoup`\uc5d0 \uba87 \uac00\uc9c0 \ud3b8\ub9ac\ud55c \uae30\ub2a5\uc744 \ucd94\uac00\ud558\uace0,\n`SoupedResponse`\ub294 `BeautifulSoup`\ub97c respone \uc548\uc5d0 \uba4b\uc9c0\uac8c \ud1b5\ud569\ud569\ub2c8\ub2e4.\n\n`SoupedResponse`\ub294 `httpx.Response`\uc758 subclass\uc774\uba74\uc11c `SoupTools`\uc758 subclass\uc774\uba70,\nhxsoup.dev\ub97c \ud3ec\ud568\ud558\uc5ec hxsoup\uc758 \ubaa8\ub4e0 response\ub294 SoupedResponse\uc785\ub2c8\ub2e4.\n\n#### The `SoupTools` methods that correspond to methods in BeautifulSoup\n\n`SoupTools`\uc5d0\ub294 BeautifulSoup\uc758 \uba54\uc18c\ub4dc\uc5d0 \ub300\uc751\ud558\ub294 \uba54\uc18c\ub4dc\ub4e4\uc774 \uc788\uc2b5\ub2c8\ub2e4.\n\n* `SoupTools.soup()`: `BeautifulSoup(...)`\uc5d0 \ub300\uc751\ud569\ub2c8\ub2e4.\n* `SoupTools.soup_select(selector)`: `BeautifulSoup(...).select(selector)`\uc5d0 \ub300\uc751\ud569\ub2c8\ub2e4.\n* `SoupTools.soup_select_one(selector)`: `BeautifulSoup(...).select_one(selector)`\uc5d0 \ub300\uc751\ud569\ub2c8\ub2e4.\n\n#### `no_empty_result`\n\n`BeautifulSoup.soup_select_one()`\uc5d0\ub294 \ud55c \uac00\uc9c0 \ubb38\uc81c\uac00 \uc788\uc2b5\ub2c8\ub2e4. \ubc14\ub85c \ud574\ub2f9\ud558\ub294 element\ub97c \ucc3e\ub294\ub370 \uc2e4\ud328\ud588\uc744 \ub54c \uc624\ub958\uac00 \uc544\ub2cc None\uc744 \ub0b4\ubc37\ub294\ub2e4\ub294 \uc810\uc785\ub2c8\ub2e4. \uc774\ub294 \uc5b4\uca54 \ub54c\ub294 \ud3b8\ub9ac\ud560\uc9c0\ub294 \ubab0\ub77c\ub3c4 typing\ub3c4 \uc5b4\ub835\uace0 `.soup_select().text`\uc640 \uac19\uc740 chaining\ub3c4 \uc5b4\ub835\uac8c \ud569\ub2c8\ub2e4.\n\nhxsoup\uc758 `response.soup_select_one()`\uc5d0\ub294 \uc774\ub7ec\ud55c \ubb38\uc81c\ub97c \ud574\uacb0\ud558\uae30 \uc704\ud574 `no_empty_result`\ub77c\ub294 \ud30c\ub77c\ubbf8\ud130\ub97c \ub3c4\uc785\ud588\uc2b5\ub2c8\ub2e4.\n\uc544\ub798\ub294 `python.org`\uc5d0 `never-gonna-selected`\ub77c\ub294 \uc120\ud0dd\uc790\uc5d0 \ub9de\ub294 \ud0dc\uadf8\uac00 \uc788\ub294\uc9c0 \ud655\uc778\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. `python.org`\uc5d0\uc11c\ub294 \uadf8\ub7f0 \ud0dc\uadf8\ub294 \uc5c6\uae30 \ub54c\ubb38\uc5d0 \uc77c\ubc18\uc801\uc73c\ub85c\ub294 None\uc744 \ubc18\ud658\ubc1b\uac8c \ub418\ub294\ub370, `no_empty_result`\uac00 True\ub77c\uba74 None\uc774 \uc544\ub2cc \uc624\ub958\ub97c raise\ud558\uac8c \ub429\ub2c8\ub2e4.\n\n```python\n>>> import hxsoup.dev as hd\n>>> res = hd.get(\"https://python.org\")\n>>> res.soup_select_one(\"never-gonna-selected\", no_empty_result=True)\nTraceback (most recent call last):\n ...\nhxsoup.exceptions.EmptyResultError: Selecting result is None. This error happens probably because of invalid selector or URL. Check whether selector and URL are both valid.\nstatus code: HTTP 200 OK, URL: https://www.python.org/, selector: 'never-gonna-selected'\n```\n\n\uac19\uc740 \ubc29\uc2dd\uc774 response.soup_select()\uc5d0\ub3c4 \uc801\uc6a9\ub429\ub2c8\ub2e4. \uc774 \uacbd\uc6b0 \ube48 \ub9ac\uc2a4\ud2b8\uac00 \ub9ac\ud134\ub420 \ub54c EmptyResultError\uac00 \ub098\uac8c \ub429\ub2c8\ub2e4.\n\n```python\n>>> import hxsoup.dev as hd\n>>> res = hd.get(\"https://python.org\")\n>>> res.soup_select(\"never-gonna-selected\", no_empty_result=True)\nTraceback (most recent call last):\n ...\nhxsoup.exceptions.EmptyResultError: Selecting result is empty list(\"[]\"). This error happens probably because of invalid selector or URL. Check whether selector and URL are both valid.\nstatus code: HTTP 200 OK, URL: https://www.python.org/, selector: 'never-gonna-selected'\n```\n\n`response.soup_select()`\uc5d0\ub3c4 `no_empty_result`\uac00 \uc788\ub2e4\ub294 \uc810\uc744 \uc78a\uc9c0 \ub9c8\uc138\uc694. \ub530\ub77c\uc11c `Client`\ub098 `hxsoup.get` \uc790\uccb4\uc5d0 `no_empty_result`\ub97c \uc0ac\uc6a9\ud560 \ub54c\uc5d0\ub294 \uc774 \uae30\ub2a5\uc774 `response.soup_select()`\uc5d0\ub3c4 \uc801\uc6a9\ub41c\ub2e4\ub294 \uc810\uc744 \uba85\uc2ec\ud558\uc138\uc694.\n\n#### `parser`\n\nparser\uc744 \uc124\uc815\ud560 \uc218 \uc788\ub3c4\ub85d \ud569\ub2c8\ub2e4. BeautifulSoup\uc758 \uc6a9\uc5b4\ub85c\ub294 `feature`\uc785\ub2c8\ub2e4.\n\n\uae30\ubcf8\uc801\uc73c\ub85c\ub294 `'html.parser'`\ub97c \uc0ac\uc6a9\ud558\ub3c4\ub85d \ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4.\n\n#### Broadcasting\n\n`soup_select()`\uc758 \uacb0\uacfc\ub294 \ub9ac\uc2a4\ud2b8\uc785\ub2c8\ub2e4. Tag \uad00\ub828 \ucc98\ub9ac\ub97c \ud560 \ub54c\uc5d0\ub294 \ub9ac\uc2a4\ud2b8 \ucef4\ud504\ub9ac\ud5e8\uc158\uc744 \uc774\uc6a9\ud574\uc57c \ud558\ub294\ub370, \uc5ec\uac04 \uadc0\ucc2e\uc740 \uc77c\uc774 \uc544\ub2d9\ub2c8\ub2e4.\n\nhxsoup\uc5d0\uc11c `soup_select()`\uc758 \uacb0\uacfc\ub294 BroadcastList\uc774\uba70, \uc774\ub294 \uc5ec\ub7ec \ubb38\uc81c\ub97c \ud574\uacb0\ud569\ub2c8\ub2e4.\n\nBroadcastList\ub294 `.bc`\ub97c \ubd99\uc774\uba74 \ube0c\ub85c\ub4dc\uce90\uc2a4\ud305 \uac00\ub2a5\ud55c \uc0c1\ud669\uc774 \ub418\uace0 \uadf8 \ub4a4\uc5d0 \uc5b4\ub5a4 \uac83\uc744 \ubd99\uc774\ub358 \ube0c\ub85c\ub4dc\uce90\uc2a4\ud305\uc774 \uc77c\uc5b4\ub0a9\ub2c8\ub2e4.\n\n\uc608\ub97c \ub4e4\uba74 \ub2e4\uc74c\uc758 \ucf54\ub4dc\ub294\n\n```python\n>>> import hxsoup.dev as hd\n>>> res = hd.get(\"https://python.org\")\n>>> [tag.text for tag in res.soup_select(\"strong\")]\n['Notice:', 'A A', 'relaunched community-run job board']\n```\n\n\uc544\ub798\uc758 \ucf54\ub4dc\ub85c \ub300\uccb4\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n```python\n>>> import hxsoup.dev as hd\n>>> res = hd.get(\"https://python.org\")\n>>> res.soup_select(\"strong\").bc.text\n['Notice:', 'A A', 'relaunched community-run job board']\n```\n\n\ube0c\ub85c\ub4dc\uce90\uc2a4\ud305\uc744 \ub354 \ud558\uace0 \uc2f6\ub2e4\uba74 `.bc`\ub97c \ub610 \ubd99\uc774\uba74 \ub429\ub2c8\ub2e4.\n\n```python\n>>> import hxsoup.dev as hd\n>>> res = hd.get(\"https://python.org\")\n>>> res.soup_select(\"strong\").bc.text.bc[::2]\n['Ntc:', 'AA', 'rluce omnt-u o or']\n```\n\n### ClientOptions\n\n\uace0\uc815\uc801\uc73c\ub85c \uc5ec\ub7ec request\uc5d0 \ub300\ud574 \uac19\uc740 \ud0a4\uc6cc\ub4dc\ub97c \uc0ac\uc6a9\ud574\uc57c \ud558\ub294 \uacbd\uc6b0\uac00 \uc788\uc2b5\ub2c8\ub2e4. \ub300\ubd80\ubd84\uc740 Client\ub97c \uc774\uc6a9\ud558\uba74 \ud574\uacb0\ub418\uc9c0\ub9cc, AsyncClient\uc640 Client\ub97c \uac19\uc774 \uc0ac\uc6a9\ud558\uac70\ub098, httpx.get\ucc98\ub7fc \ud074\ub77c\uc774\uc5b8\ud2b8 \uc5c6\uc774 \uc0ac\uc6a9\ud558\uace0 \uc2f6\uc740 \uacbd\uc6b0\ub3c4 \uc788\uc744 \uac83\uc785\ub2c8\ub2e4. \uc774\ub7f4 \uacbd\uc6b0 \uc774 \ud074\ub798\uc2a4\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n```python\n(.venv) C:\\Users\\USER\\Programming\\vscode\\git\\hxsoup>py -3.12 -m asyncio\nasyncio REPL 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32\nUse \"await\" directly instead of \"asyncio.run()\".\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import asyncio\n>>> from hxsoup import ClientOptions\n>>>\n>>> options = ClientOptions(follow_redirects=True)\n>>> print(options.get(\"https://python.org\"))\n<Response [200 OK]>\n>>> with options.build_client() as client:\n... print(client.get(\"https://python.org\"))\n...\n<Response [200 OK]>\n>>> async with options.build_async_client() as async_client:\n... print(await client.get(\"https://python.org\"))\n...\n<Response [200 OK]>\n```\n\n### `hxsoup.dev`\n\n\uc77c\ubd80 \uae30\ubcf8\uac12\uc744 \uc7ac\uc870\uc815\ud558\uace0 caching\uc774 \ud3ec\ud568\ub41c \ubaa8\ub4c8\uc785\ub2c8\ub2e4.\n\n#### Adjusted defaults\n\n\uac1c\ubc1c \uc911\uc5d0\ub294 \uc77c\ubd80 \ud30c\ub77c\ubbf8\ud130\uac00 \ud754\ud788 \ub9ce\uc774 \uc0ac\uc6a9\ub429\ub2c8\ub2e4. \uc608\ub97c \ub4e4\uc5b4 `follow_redirects` \ud30c\ub77c\ubbf8\ud130\ub294 httpx\uc5d0\uc11c \uae30\ubcf8\uc801\uc73c\ub85c \uaebc\uc838 \uc788\uc9c0\ub9cc \uc774\ub978 \uac1c\ubc1c \uc0ac\uc774\ud074\uc5d0 \uc788\ub294 \uacbd\uc6b0 \ucf1c\uc838 \uc788\ub294 \uac83\uc774 \ud3b8\ud55c \uacbd\uc6b0\uac00 \ub9ce\uc2b5\ub2c8\ub2e4.\n\n\uac1c\ubc1c\uc790\uc758 \ud3b8\uc758\ub97c \uc704\ud574 `follow_redirects`\ub97c \ube44\ub86f\ud55c \uba87\uba87 \ud30c\ub77c\ubbf8\ud130\ub4e4\uc740 httpx\uc758 \uae30\ubcf8 \uc124\uc815\uac12\uacfc\ub294 \ub2e4\ub978 \uac12\uc744 \uc774\uc6a9\ud569\ub2c8\ub2e4.\n\n| \ud30c\ub77c\ubbf8\ud130 \uc774\ub984 | hxsoup \uae30\ubcf8\uac12 | `hxsoup.dev` \uae30\ubcf8\uac12 |\n|--------------|--------------|---------------------|\n| `follow_redirects` | False | True |\n| `headers` | None | `DEV_HEADERS` |\n\n```python\n>>> import hxsoup\n>>> hxsoup.get(\"https://python.org\")\n<Response [301 Moved Permanently]>\n>>>\n>>> import hxsoup.dev as hd\n>>> # follow_redirects\uac00 True\uc784.\n>>> hd.get(\"https://python.org\")\n<Response [200 OK]>\n```\n\n`DEV_HEADERS`\uc758 \ub0b4\uc6a9\uc740 Chrome \ube0c\ub77c\uc6b0\uc800\uc758 \uae30\ubcf8 \ud5e4\ub354\uc774\uba70 \ub0b4\uc6a9\uc740 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.\n\n```python\n{\n \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7\",\n \"Accept-Encoding\": \"gzip, deflate, br\",\n \"Accept-Language\": \"ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7\",\n \"Sec-Ch-Ua\": '\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"',\n \"Sec-Ch-Ua-Arch\": '\"x86\"',\n \"Sec-Ch-Ua-Bitness\": '\"64\"',\n \"Sec-Ch-Ua-Full-Version-List\": '\"Not_A Brand\";v=\"8.0.0.0\", \"Chromium\";v=\"120.0.6099.130\", \"Google Chrome\";v=\"120.0.6099.130\"',\n \"Sec-Ch-Ua-Mobile\": \"?0\",\n \"Sec-Ch-Ua-Model\": '\"\"',\n \"Sec-Ch-Ua-Platform\": '\"Windows\"',\n \"Sec-Ch-Ua-Platform-Version\": '\"15.0.0\"',\n \"Sec-Ch-Ua-Wow64\": \"?0\",\n \"Sec-Fetch-Dest\": \"document\",\n \"Sec-Fetch-Mode\": \"navigate\",\n \"Sec-Fetch-Site\": \"none\",\n \"Sec-Fetch-User\": \"?1\",\n \"Upgrade-Insecure-Requests\": \"1\",\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36\",\n}\n```\n\n#### cached requests\n\n\ud65c\ubc1c\ud55c \uac1c\ubc1c \uc911\uc5d0\ub294, \ud2b9\ud788 Jupyter\ub97c \uc774\uc6a9\ud560 \ub54c\ub294, \uc77c\ubd80 requests\ub97c \uacc4\uc18d\ud574\uc11c \ubcf4\ub0b4\uac8c \ub418\ub294 \uacbd\uc6b0\uac00 \uc788\uc2b5\ub2c8\ub2e4. \uc774\ub294 \uc11c\ubc84\uc5d0 \ubd80\ub2f4\uc744 \uc8fc\uace0 \uac1c\ubc1c \uc18d\ub3c4\ub97c \ub2a6\ucda5\ub2c8\ub2e4.\n\n\uac01 \uba54\uc18c\ub4dc\uc758 \uc55e\uc5d0 c\ub97c \ubd99\uc774\uba74 \uc751\ub2f5\uc774 \uce90\uc2f1\ub429\ub2c8\ub2e4.\n\n\uc608\ub97c \ub4e4\uc5b4 \uc2dc\uac04\uc744 \ube44\uad50\ud558\uba74 \uc544\ub798\uc640 \uac19\uc774 \ub429\ub2c8\ub2e4.\n\n```python\n>>> from timeit import timeit\n>>> timeit('hd.get(\"https://python.org\")', setup=\"import hxsoup.dev as hd\", number=10)\n0.7851526000013109\n>>> timeit('hd.cget(\"https://python.org\")', setup=\"import hxsoup.dev as hd\", number=10)\n0.061434000002918765\n```\n\noptions/head/post/put/patch/delete\ub4e4\ub3c4 \ub9c8\ucc2c\uac00\uc9c0\ub85c \ub300\uc751\ub418\ub294 coptions/chead/cpost/cput/cpatch/cdelete\uac00 \uc788\uc2b5\ub2c8\ub2e4.\n\n```python\n>>> from timeit import timeit\n>>> timeit('hd.post(\"https://httpbin.org/post\")', setup=\"import hxsoup.dev as hd\", number=10)\n9.307660000005853\n>>> timeit('hd.cpost(\"https://httpbin.org/post\")', setup=\"import hxsoup.dev as hd\", number=10)\n0.8557240999944042\n```\n\n\uce90\uc2dc\ub294 lru_cache \uae30\ubcf8\uac12\uc744 \uc0ac\uc6a9\ud558\uae30 \ub54c\ubb38\uc5d0 \uba54\uc18c\ub4dc \uad6c\ubd84 \uc5c6\uc774 128\uac1c\uae4c\uc9c0 \uc800\uc7a5\ub429\ub2c8\ub2e4.\n\n#### Client/ClientOptions\n\nClient\uc640 ClientOptions\uc5d0\ub3c4 \ub9c8\ucc2c\uac00\uc9c0\ub85c \uae30\ubcf8 \uc635\uc158\uc744 \uc0ac\uc6a9 \uac00\ub2a5\ud569\ub2c8\ub2e4.\n\n```python\n>>> import hxsoup.dev as hd\n>>> import hxsoup\n>>>\n>>> client = hxsoup.Client()\n>>> client.get(\"https://python.org\")\n<Response [301 Moved Permanently]>\n>>>\n>>> dev_client = hd.Client()\n>>> dev_client.get(\"https://python.org\")\n<Response [200 OK]>\n>>>\n>>> options = hxsoup.ClientOptions()\n>>> options.get(\"https://python.org\")\n<Response [301 Moved Permanently]>\n>>>\n>>> dev_options = hd.ClientOptions()\n>>> dev_options.get(\"https://python.org\")\n<Response [200 OK]>\n```\n\n## License information\n\n\uc774 \ud504\ub85c\uadf8\ub7a8\uc758 \uc77c\ubd80\ub294 [resoup(\ubcf8\uc778 \uc81c\uc791)](https://github.com/ilotoki0804/resoup) \ub77c\uc774\ube0c\ub7ec\ub9ac\uc5d0 \uc788\ub358 \ucf54\ub4dc\ub97c \ud3ec\ud568\ud569\ub2c8\ub2e4.\nSome part of this program contains code from [resoup(created and developed by me)](https://github.com/ilotoki0804/resoup) library.\n\n\uc774 \ud504\ub85c\uadf8\ub7a8\uc758 \uc77c\ubd80\ub294 [httpx(BSD-3-Clause license)](https://github.com/encode/httpx) \ub77c\uc774\ube0c\ub7ec\ub9ac\uc5d0 \uc788\ub358 \ucf54\ub4dc\ub97c \ud3ec\ud568\ud569\ub2c8\ub2e4.\nSome part of this program contains code from [httpx](https://github.com/encode/httpx) library.\n\n## Motivation and blathers\n\n\uc774\uc804\uc5d0 requests\uc758 \ubd88\ud3b8\ud55c \uc810\uc744 \ub290\ub07c\uace0 \uad00\ub828 \ub0b4\uc6a9\uc744 \uc785\ub9db\uc5d0 \ub9de\uac8c \uc218\uc815\ud55c resoup\ub77c\ub294 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \ub9cc\ub4e4\uc5b4 \uc0ac\uc6a9\ud558\uace0 \uc788\uc5c8\uc2b5\ub2c8\ub2e4.\n\n\uadf8\ub7ec\ub358 \uc5b4\ub290 \ub0a0 [ArjanCodes\uc758 \uc601\uc0c1](https://www.youtube.com/watch?v=OPyoXx0yA0I)\uc5d0\uc11c httpx\uc5d0 \ub300\ud574 \ub2e4\uc2dc \ubcf4\uac8c \ub418\uace0 \uc2e4\uc81c\ub85c \uc0ac\uc6a9\ud574\ubcf4\ub2c8 requests\uc640 \uc0c1\uc704 \ud638\ud658\ub418\ub294 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub77c\ub294 \uc810\uc744 \uc54c\uac8c \ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n\n\ub530\ub77c\uc11c httpx\uc744 \uc55e\uc73c\ub85c\uc758 \ud504\ub85c\uc81d\ud2b8\ub4e4\uc5d0\uc11c \uc0ac\uc6a9\ud558\uae30\ub85c \uacb0\uc815\ud588\uace0, resoup\uc758 \uae30\ub2a5\uc744 \ud3ec\uae30\ud560 \uc218 \uc5c6\uc5c8\uae30\uc5d0 requests\uc758 \uacbd\uc6b0\uc640 \ub9c8\ucc2c\uac00\uc9c0\ub85c resoup\uc5d0 \ub300\uc751\ud558\ub294 httpx\uc5d0 \ub300\ud55c \uc720\ud2f8\ub9ac\ud2f0\ub97c \ub9cc\ub4e4\uae30\ub85c \ud588\uc73c\uba70 \uadf8 \uacb0\uacfc\uac00 hxsoup\uc785\ub2c8\ub2e4.\n\nresoup\uacfc \ube44\uad50\ud588\uc744 \ub54c \uac1c\ubc1c \uacbd\ud5d8\uc740 hxsoup \ucabd\uc774 \uc555\ub3c4\uc801\uc73c\ub85c \uc88b\uc558\ub294\ub370, requests\ub294 type hint\uac00 \ub098\uc624\uae30 \uc804 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub77c \uadf8\ub7f0\uc9c0 \ud6a8\uc728\uc801\uc774\uc9c0\ub9cc type hint\ub97c \uc801\uc6a9\ud558\uae30\uc5d0\ub294 \ucd5c\uc545\uc774\uc5c8\ub358 \ubc18\uba74, httpx\ub294 \ub530\ub85c type stub\ub098 typing.overload\ub97c \uac70\uc758 \uc0ac\uc6a9\ud558\uc9c0 \uc54a\uc558\uc744 \uc815\ub3c4\ub85c \ub9e4\uc6b0 \uc548\uc815\uc801\uc774\uace0 typing\uc744 \uc801\uc6a9\ud558\uba74\uc11c \uac1c\ubc1c\ud558\uae30\uc5d0\ub3c4 \uc88b\uc558\uc2b5\ub2c8\ub2e4. (\ubb3c\ub860 resoup\uc744 \ub9cc\ub4e4\uba74\uc11c \uc0dd\uae34 \ub178\ud558\uc6b0\ub3c4 \ub9ce\uc774 \ub3c4\uc6c0\uc774 \ub418\uc5c8\uaca0\uc9c0\ub9cc\uc694.)\n\n## Changelog\n\n* 0.5.1 (2024-10-02): \ube4c\ub4dc \uc2dc\uc2a4\ud15c\uc5d0 uv \uc0ac\uc6a9, attempt \ub300\uc0c1\uc5d0 SSLError\ub3c4 \ucd94\uac00\n* 0.5.0 (2024-06-22): logger \uc0ac\uc6a9, \ube4c\ub4dc \ud604\ub300\ud654, \uc758\uc874\uc131 \uc5c5\uadf8\ub808\uc774\ub4dc, \uae30\ud0c0 \ubb38\uc11c \ubc0f \ucf54\ub4dc \uac1c\uc120\n* 0.4.1 (2024-01-24): caching \uc81c\uac70, broadcasting \ub9c8\uc800 \uc81c\uac70.\n* 0.4.0 (2024-01-23): NotEmptySoupTools\uc640 NotEmptySoupedResponse \ucd94\uac00, soup_select\uc640 soup_select_one\uc5d0 **kwargs \ucd94\uac00, \ubc84\uadf8 \uc218\uc815\n* 0.3.0 (2024-01-04): ClientOptions \ucd94\uac00, \ucf54\ub4dc \ubc0f \ubc84\uadf8 \uc218\uc815\n* 0.2.0 (2024-01-01): \uc5ec\ub7ec \uae30\ub2a5\uc744 \ucd94\uac00\ud558\uace0 \uc218\uc815.\n* 0.1.0 (2023-12-28): \uccab (\ud504\ub9ac)\ub9b4\ub9ac\uc988\n",
"bugtrack_url": null,
"license": null,
"summary": "Various convenient features related to httpx and BeautifulSoup.",
"version": "0.6.0",
"project_urls": null,
"split_keywords": [
"beautifulsoup",
" beautifulsoup4",
" bs4",
" httpx",
" request",
" soup"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fa1910c29eee25d3c8be3fb44c6b6d49d71bce04e917faa3b9fabe3463153900",
"md5": "2500ca8ce5c009551b1525f2ba1ab5a8",
"sha256": "679115cbc81385dd9d722ee119ff38392638417dcd3e736546a1351d638d4325"
},
"downloads": -1,
"filename": "hxsoup-0.6.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2500ca8ce5c009551b1525f2ba1ab5a8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 28023,
"upload_time": "2024-11-02T10:02:27",
"upload_time_iso_8601": "2024-11-02T10:02:27.542729Z",
"url": "https://files.pythonhosted.org/packages/fa/19/10c29eee25d3c8be3fb44c6b6d49d71bce04e917faa3b9fabe3463153900/hxsoup-0.6.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "242a3a62d01d892ae80216dbbd4d8084f5833843f50fb1e6d4094ecf05660b22",
"md5": "6e34dd095623ebcc1f6d9f9e2745dea6",
"sha256": "b368b1099946234b63333376ab2e2327b83f38a25aa8da2bd26443b64011a904"
},
"downloads": -1,
"filename": "hxsoup-0.6.0.tar.gz",
"has_sig": false,
"md5_digest": "6e34dd095623ebcc1f6d9f9e2745dea6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 83124,
"upload_time": "2024-11-02T10:02:29",
"upload_time_iso_8601": "2024-11-02T10:02:29.567289Z",
"url": "https://files.pythonhosted.org/packages/24/2a/3a62d01d892ae80216dbbd4d8084f5833843f50fb1e6d4094ecf05660b22/hxsoup-0.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-02 10:02:29",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "hxsoup"
}