httpc


Namehttpc JSON
Version 0.6.0 PyPI version JSON
download
home_pageNone
Summaryhttpx with css.
upload_time2024-12-01 01:58:08
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords 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.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.9",
    "maintainer_email": null,
    "keywords": "css, httpx, request, selectolax, soup",
    "author": null,
    "author_email": "ilotoki0804 <ilotoki0804@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/87/f3/4af91596efdd850ce88602baa8ea3a6ff7d1004d2e5aff198724619674eb/httpc-0.6.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.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": "MIT",
    "summary": "httpx with css.",
    "version": "0.6.0",
    "project_urls": null,
    "split_keywords": [
        "css",
        " httpx",
        " request",
        " selectolax",
        " soup"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e77307ffde07bb7b171824b70fae5d8ae4a77f7512b94a7d98c40d3630044fbe",
                "md5": "94b5fc6246cb5ac965609e6d1901bcef",
                "sha256": "097d369561947ada63fde13ed3b8d90c12622b6b535dcaa4bc92c519aa6991cd"
            },
            "downloads": -1,
            "filename": "httpc-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "94b5fc6246cb5ac965609e6d1901bcef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 10906,
            "upload_time": "2024-12-01T01:57:51",
            "upload_time_iso_8601": "2024-12-01T01:57:51.875820Z",
            "url": "https://files.pythonhosted.org/packages/e7/73/07ffde07bb7b171824b70fae5d8ae4a77f7512b94a7d98c40d3630044fbe/httpc-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "87f34af91596efdd850ce88602baa8ea3a6ff7d1004d2e5aff198724619674eb",
                "md5": "46d5853d8a9265d11c387346214199ff",
                "sha256": "ff189fe11a33bbe1f7b82e71fa691f3641bff97c7c3e4bbfe486efcddf017f60"
            },
            "downloads": -1,
            "filename": "httpc-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "46d5853d8a9265d11c387346214199ff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 104738,
            "upload_time": "2024-12-01T01:58:08",
            "upload_time_iso_8601": "2024-12-01T01:58:08.411123Z",
            "url": "https://files.pythonhosted.org/packages/87/f3/4af91596efdd850ce88602baa8ea3a6ff7d1004d2e5aff198724619674eb/httpc-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-01 01:58:08",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "httpc"
}
        
Elapsed time: 0.37233s