httpc
httpx with CSS
Installation
pip install -U httpc
Examples
>>> 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.14.0.post1: selectolax가 python3.15를 적용하지 않으므로 해당 내용을 requires-python에 반영
- 0.14.0:
httpc selectsubcommand 추가, 기본 headers 변경, cookie_utils 추가 - 0.13.0: next_data 처리 방식 변경
- 0.12.0:
httpc.catcher의 데이터베이스 형식 변경, migration 추가,httpc.catcher migrateCLI 명령어 추가 - 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), 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
newparameter, removeselectmethod, renamecsstomatchfrom CSSTool, remove cache_api.py (unused script), add url note, retry if server error on raise_for_status, bugfix - 0.2.0: Initial release
Metadata
Release files for httpc 0.14.0.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| httpc-0.14.0.post1.tar.gz | 100.7 kB | Without provenance | Details for httpc-0.14.0.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| httpc-0.14.0.post1-py3-none-any.whl | Python 3 | none | any | Details for httpc-0.14.0.post1-py3-none-any.whl |
Total release size: 130.4 kB
Release files / httpc-0.14.0.post1.tar.gz
| Download URL | httpc-0.14.0.post1.tar.gz |
|---|---|
| Size | 100.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
711a907f6335345bd8307abb56ee2df093ecabfac1e49ab112a19a2161f35958
|
|
BLAKE2b-256 checksum How to use checksums |
0860f816e3d11eaab418196de9f1853ed0e9a591953a88228793c8586559ec96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.18.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.13.15"},"installer":{"name":"hatch","version":"1.18.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.13.15","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.13.1
|
Release files / httpc-0.14.0.post1-py3-none-any.whl
| Download URL | httpc-0.14.0.post1-py3-none-any.whl |
|---|---|
| Size | 29.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
290180b14b86f6f3870768350c3e7ad42ab8805ef4d37c49f0bfc0a3189f13ca
|
|
BLAKE2b-256 checksum How to use checksums |
cff3a06a6dc9c42265f5d8c9b5001ff799e4614a292e75c9206fdfb54eea9996
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.18.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.13.15"},"installer":{"name":"hatch","version":"1.18.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.13.15","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.13.1
|
Security for httpc 0.14.0.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.