httpc


Namehttpc JSON
Version 0.11.0 PyPI version JSON
download
home_pageNone
Summaryhttpx with css.
upload_time2025-08-30 17:49:05
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords catcher css httpx request selectolax soup
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # httpc

[![Sponsoring](https://img.shields.io/badge/Sponsoring-Patreon-blue?logo=patreon&logoColor=white)](https://www.patreon.com/ilotoki0804)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Filotoki0804%2Fhttpc&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://github.com/ilotoki0804/httpc)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/httpc)](https://pypi.org/project/httpc/)
[![image](https://img.shields.io/pypi/l/httpc.svg)](https://github.com/ilotoki0804/httpc/blob/main/LICENSE)
[![image](https://img.shields.io/pypi/pyversions/httpc.svg)](https://pypi.org/project/httpc/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/ilotoki0804/httpc/blob/main/pyproject.toml)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/ilotoki0804/httpc/blob/main/pyproject.toml)

**httpx with CSS**

## Installation

```console
pip install -U httpc
```

## Examples

```python
>>> import httpc
>>> response = httpc.get("https://www.python.org/")
>>> response.match("strong")  # CSS Matching
[<Node strong>, <Node strong>, <Node strong>]
>>> response.match("strong").bc.text()  # Broadcasting
['Notice:', 'A A', 'relaunched community-run job board']
>>> response.single("div")  # .single() method
ValueError: Query 'div' matched with 47 nodes (error from 'https://www.python.org/').
>>> response.single("div", remain_ok=True)  # .single() method
<Node div>
>>> response.single("#content")
<Node div>
>>> httpc.get("https://python.org")
<Response [301 Moved Permanently]>
>>> httpc.common.get("https://python.org")  # ClientOptions and httpc.common
<Response [200 OK]>
>>> httpc.common.get("https://hypothetical-unstable-website.com/", retry=5)  # retry parameter
Attempting fetch again (ConnectError)...
Attempting fetch again (ConnectError)...
Successfully retrieve 'https://hypothetical-unstable-website.com/'
<Response [200 OK]>
>>> httpc.get("https://httpbin.org/status/400")
<Response [400 BAD REQUEST]>
>>> httpc.get("https://httpbin.org/status/400", raise_for_status=True)  # raise_for_status as parameter
httpx.HTTPStatusError: Client error '400 BAD REQUEST' for url 'https://httpbin.org/status/400'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
>>> httpc.get("https://httpbin.org/status/500", raise_for_status=True, retry=3)
Attempting fetch again (status code 500)...
Attempting fetch again (status code 500)...
Attempting fetch again (status code 500)...
httpx.HTTPStatusError: Server error '500 INTERNAL SERVER ERROR' for url 'https://httpbin.org/status/500'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500
```

## Release Note

* 0.11.0: `httpc`를 통해 cli 접근, `httpc cookies` 추가, 기타 다양한 기능 개선
* 0.10.0.post1: httpc-clean에서 method 입력 (-X)도 인식, ParseTool.extract_next_data와 ParseTool.next_data 추가, httpc-next-data cli 추가, 기타 버그 수정 및 리팩토링
* 0.9.1: 버그 수정 및 개선
* 0.9.0: catcher에서 헤더가 다를 경우 다른 request로 취급하는 distinguish_headers 추가, ValueError 대신 RequestNotFoundError 사용, headers 최신화, 기타 리팩토링
* 0.8.0: httpc-clean 기능 data와 cookie 파라미터도 받도록 확장, 파이썬 3.10 이상으로 지원 범위 좁힘, catcher.install 함수를 catcher.install_httpx으로 이름 변경, retry 설정 시 httpx의 오류에만 retry하도록 변경
* 0.7.0: Add httpc.catcher (from [httpx-catcher](https://github.com/ilotoki0804/httpx-catcher)), add httpc-clean CLI script for sanitizing headers
* 0.6.0: Remove deprecated parameters, remove ClientOptions
* 0.5.0: Use Lexbor as default backend, fix and improve retry and raise_for_status
* 0.4.0: Fix incorrect type hint, rename CSSTool to ParseTool, CSSResponse to Response, bugfixes and small improvements
* 0.3.0: Add `new` parameter, remove `select` method, rename `css` to `match` from CSSTool, remove cache_api.py (unused script), add url note, retry if server error on raise_for_status, bugfix
* 0.2.0: Initial release

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "httpc",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "catcher, css, httpx, request, selectolax, soup",
    "author": null,
    "author_email": "ilotoki0804 <ilotoki0804@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/db/73/6f3b596a7dace8e030648b23365d8d597360bd87e0f8908da9fa5bf2cc42/httpc-0.11.0.tar.gz",
    "platform": null,
    "description": "# httpc\n\n[![Sponsoring](https://img.shields.io/badge/Sponsoring-Patreon-blue?logo=patreon&logoColor=white)](https://www.patreon.com/ilotoki0804)\n[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Filotoki0804%2Fhttpc&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://github.com/ilotoki0804/httpc)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/httpc)](https://pypi.org/project/httpc/)\n[![image](https://img.shields.io/pypi/l/httpc.svg)](https://github.com/ilotoki0804/httpc/blob/main/LICENSE)\n[![image](https://img.shields.io/pypi/pyversions/httpc.svg)](https://pypi.org/project/httpc/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/ilotoki0804/httpc/blob/main/pyproject.toml)\n[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/ilotoki0804/httpc/blob/main/pyproject.toml)\n\n**httpx with CSS**\n\n## Installation\n\n```console\npip install -U httpc\n```\n\n## Examples\n\n```python\n>>> import httpc\n>>> response = httpc.get(\"https://www.python.org/\")\n>>> response.match(\"strong\")  # CSS Matching\n[<Node strong>, <Node strong>, <Node strong>]\n>>> response.match(\"strong\").bc.text()  # Broadcasting\n['Notice:', 'A A', 'relaunched community-run job board']\n>>> response.single(\"div\")  # .single() method\nValueError: Query 'div' matched with 47 nodes (error from 'https://www.python.org/').\n>>> response.single(\"div\", remain_ok=True)  # .single() method\n<Node div>\n>>> response.single(\"#content\")\n<Node div>\n>>> httpc.get(\"https://python.org\")\n<Response [301 Moved Permanently]>\n>>> httpc.common.get(\"https://python.org\")  # ClientOptions and httpc.common\n<Response [200 OK]>\n>>> httpc.common.get(\"https://hypothetical-unstable-website.com/\", retry=5)  # retry parameter\nAttempting fetch again (ConnectError)...\nAttempting fetch again (ConnectError)...\nSuccessfully retrieve 'https://hypothetical-unstable-website.com/'\n<Response [200 OK]>\n>>> httpc.get(\"https://httpbin.org/status/400\")\n<Response [400 BAD REQUEST]>\n>>> httpc.get(\"https://httpbin.org/status/400\", raise_for_status=True)  # raise_for_status as parameter\nhttpx.HTTPStatusError: Client error '400 BAD REQUEST' for url 'https://httpbin.org/status/400'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400\n>>> httpc.get(\"https://httpbin.org/status/500\", raise_for_status=True, retry=3)\nAttempting fetch again (status code 500)...\nAttempting fetch again (status code 500)...\nAttempting fetch again (status code 500)...\nhttpx.HTTPStatusError: Server error '500 INTERNAL SERVER ERROR' for url 'https://httpbin.org/status/500'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500\n```\n\n## Release Note\n\n* 0.11.0: `httpc`\ub97c \ud1b5\ud574 cli \uc811\uadfc, `httpc cookies` \ucd94\uac00, \uae30\ud0c0 \ub2e4\uc591\ud55c \uae30\ub2a5 \uac1c\uc120\n* 0.10.0.post1: httpc-clean\uc5d0\uc11c method \uc785\ub825 (-X)\ub3c4 \uc778\uc2dd, ParseTool.extract_next_data\uc640 ParseTool.next_data \ucd94\uac00, httpc-next-data cli \ucd94\uac00, \uae30\ud0c0 \ubc84\uadf8 \uc218\uc815 \ubc0f \ub9ac\ud329\ud1a0\ub9c1\n* 0.9.1: \ubc84\uadf8 \uc218\uc815 \ubc0f \uac1c\uc120\n* 0.9.0: catcher\uc5d0\uc11c \ud5e4\ub354\uac00 \ub2e4\ub97c \uacbd\uc6b0 \ub2e4\ub978 request\ub85c \ucde8\uae09\ud558\ub294 distinguish_headers \ucd94\uac00, ValueError \ub300\uc2e0 RequestNotFoundError \uc0ac\uc6a9, headers \ucd5c\uc2e0\ud654, \uae30\ud0c0 \ub9ac\ud329\ud1a0\ub9c1\n* 0.8.0: httpc-clean \uae30\ub2a5 data\uc640 cookie \ud30c\ub77c\ubbf8\ud130\ub3c4 \ubc1b\ub3c4\ub85d \ud655\uc7a5, \ud30c\uc774\uc36c 3.10 \uc774\uc0c1\uc73c\ub85c \uc9c0\uc6d0 \ubc94\uc704 \uc881\ud798, catcher.install \ud568\uc218\ub97c catcher.install_httpx\uc73c\ub85c \uc774\ub984 \ubcc0\uacbd, retry \uc124\uc815 \uc2dc httpx\uc758 \uc624\ub958\uc5d0\ub9cc retry\ud558\ub3c4\ub85d \ubcc0\uacbd\n* 0.7.0: Add httpc.catcher (from [httpx-catcher](https://github.com/ilotoki0804/httpx-catcher)), add httpc-clean CLI script for sanitizing headers\n* 0.6.0: Remove deprecated parameters, remove ClientOptions\n* 0.5.0: Use Lexbor as default backend, fix and improve retry and raise_for_status\n* 0.4.0: Fix incorrect type hint, rename CSSTool to ParseTool, CSSResponse to Response, bugfixes and small improvements\n* 0.3.0: Add `new` parameter, remove `select` method, rename `css` to `match` from CSSTool, remove cache_api.py (unused script), add url note, retry if server error on raise_for_status, bugfix\n* 0.2.0: Initial release\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "httpx with css.",
    "version": "0.11.0",
    "project_urls": null,
    "split_keywords": [
        "catcher",
        " css",
        " httpx",
        " request",
        " selectolax",
        " soup"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7ec0807364df655078f1e425b418419185acf1941907b799d83be244d79014de",
                "md5": "9854ad4510b2c38b5e3cf07c63104ce7",
                "sha256": "964c990689005f2848918e629e8fad725672d53925ff3788808452225de36815"
            },
            "downloads": -1,
            "filename": "httpc-0.11.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9854ad4510b2c38b5e3cf07c63104ce7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 26600,
            "upload_time": "2025-08-30T17:49:04",
            "upload_time_iso_8601": "2025-08-30T17:49:04.112564Z",
            "url": "https://files.pythonhosted.org/packages/7e/c0/807364df655078f1e425b418419185acf1941907b799d83be244d79014de/httpc-0.11.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "db736f3b596a7dace8e030648b23365d8d597360bd87e0f8908da9fa5bf2cc42",
                "md5": "d735959e3a720143678e5417acbc350c",
                "sha256": "e1d6e71cd675936fcc683093787b9de96c4206d32e3b44e2400761fe108f60b8"
            },
            "downloads": -1,
            "filename": "httpc-0.11.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d735959e3a720143678e5417acbc350c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 98178,
            "upload_time": "2025-08-30T17:49:05",
            "upload_time_iso_8601": "2025-08-30T17:49:05.440375Z",
            "url": "https://files.pythonhosted.org/packages/db/73/6f3b596a7dace8e030648b23365d8d597360bd87e0f8908da9fa5bf2cc42/httpc-0.11.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-30 17:49:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "httpc"
}
        
Elapsed time: 1.15245s