searxng-search


Namesearxng-search JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryWeb search using the searxng instances
upload_time2024-12-28 13:50:56
maintainerNone
docs_urlNone
authordeedy5
requires_python>=3.8
licenseMIT License
keywords python searxng
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Python >= 3.8](https://img.shields.io/badge/python->=3.8-red.svg) [![](https://badgen.net/github/release/deedy5/searxng_search)](https://github.com/deedy5/searxng_search/releases) [![](https://badge.fury.io/py/searxng-search.svg)](https://pypi.org/project/searxng-search) [![Downloads](https://static.pepy.tech/badge/searxng-search)](https://pepy.tech/project/searxng-search) [![Downloads](https://static.pepy.tech/badge/searxng-search/week)](https://pepy.tech/project/searxng-search)
# searxng_search<a name="TOP"></a>

Web search using the searxng instances.

## Table of Contents
* [Install](#install)
* [SearxngSearch class](#searxngsearch-class)
  * [Proxy](#proxy)
  * [Exceptions](#exceptions)
  * [search()](#search)

___
## Install
```python
pip install -U searxng_search
```
___
## SearxngSearch class
```python3
"""Searxng search. Query params: https://docs.searxng.org/dev/search_api.html.

Args:
    q: search query.
    language: code of the language. Defaults to "auto".
    pageno: search page number. Defaults to 1.
    time_range: "day", "week", "month", "year". Defaults to "".
    safesearch: 0, 1, 2. Defaults to 1.
"""
```

Here is an example of initializing the SeaxngSearch class.
```python3
from searxng_search import SearxngSearch

results = SearxngSearch().search("python")
print(results)
```
___
### Proxy

Package supports http/https/socks proxies. Example: `http://user:pass@example.com:3128`.
Use a rotating proxy. Otherwise, use a new proxy with each SearxngSearch class initialization.

*1. The easiest way. Launch the Tor Browser*
```python3
from searxng_search import SearxngSearch

ss = SearxngSearch(proxy="socks5://127.0.0.1:9150", timeout=20)
results = SS.search("python")
```
*2. Use any proxy server* (*example with [iproyal rotating residential proxies](https://iproyal.com?r=residential_proxies)*)
```python3
from searxng_search import SearxngSearch

ss = SearxngSearch(proxy="socks5h://user:password@geo.iproyal.com:32325", timeout=20)
results = ss.text("something you need")
```
*3. The proxy can also be set using the `SEARXNG_PROXY` environment variable.*
```python3
export SEARXNG_PROXY="socks5h://user:password@geo.iproyal.com:32325"
```
___
### Exceptions

Exceptions:
- `SearxngSearchException`: Base exception for searxng_search errors.
- `RatelimitException`: Inherits from SearxngSearchException, raised for exceeding request rate limits.
- `TimeoutException`: Inherits from SearxngSearchException, raised for request timeouts.
___
### search()

```python
def search(
    self,
    q: str,
    language: str = "auto",
    pageno: str | int = 1,
    time_range: str = "",
    safesearch: str | int = 1,
) -> list[dict[str, str]]:
    """Searxng search. Query params: https://docs.searxng.org/dev/search_api.html.

    Args:
        q: search query.
        language: code of the language. Defaults to "auto".
        pageno: search page number. Defaults to 1.
        time_range: "day", "week", "month", "year". Defaults to "".
        safesearch: 0, 1, 2. Defaults to 1.

    Returns:
        List of dictionaries with search results.
```
***Example***
```python
from searxng_search import SS  # SS = SearxngSearch (alias)

results = SS().search("python", language="fr", pageno=4, time_range="year", safesearch=0)
print(results)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "searxng-search",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "python, searxng",
    "author": "deedy5",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/fc/ac/a8e686e20f4c57c0742332378e9b6eff2f5ba5dec2b35304c1dac87e3a9b/searxng_search-0.1.1.tar.gz",
    "platform": null,
    "description": "![Python >= 3.8](https://img.shields.io/badge/python->=3.8-red.svg) [![](https://badgen.net/github/release/deedy5/searxng_search)](https://github.com/deedy5/searxng_search/releases) [![](https://badge.fury.io/py/searxng-search.svg)](https://pypi.org/project/searxng-search) [![Downloads](https://static.pepy.tech/badge/searxng-search)](https://pepy.tech/project/searxng-search) [![Downloads](https://static.pepy.tech/badge/searxng-search/week)](https://pepy.tech/project/searxng-search)\n# searxng_search<a name=\"TOP\"></a>\n\nWeb search using the searxng instances.\n\n## Table of Contents\n* [Install](#install)\n* [SearxngSearch class](#searxngsearch-class)\n  * [Proxy](#proxy)\n  * [Exceptions](#exceptions)\n  * [search()](#search)\n\n___\n## Install\n```python\npip install -U searxng_search\n```\n___\n## SearxngSearch class\n```python3\n\"\"\"Searxng search. Query params: https://docs.searxng.org/dev/search_api.html.\n\nArgs:\n    q: search query.\n    language: code of the language. Defaults to \"auto\".\n    pageno: search page number. Defaults to 1.\n    time_range: \"day\", \"week\", \"month\", \"year\". Defaults to \"\".\n    safesearch: 0, 1, 2. Defaults to 1.\n\"\"\"\n```\n\nHere is an example of initializing the SeaxngSearch class.\n```python3\nfrom searxng_search import SearxngSearch\n\nresults = SearxngSearch().search(\"python\")\nprint(results)\n```\n___\n### Proxy\n\nPackage supports http/https/socks proxies. Example: `http://user:pass@example.com:3128`.\nUse a rotating proxy. Otherwise, use a new proxy with each SearxngSearch class initialization.\n\n*1. The easiest way. Launch the Tor Browser*\n```python3\nfrom searxng_search import SearxngSearch\n\nss = SearxngSearch(proxy=\"socks5://127.0.0.1:9150\", timeout=20)\nresults = SS.search(\"python\")\n```\n*2. Use any proxy server* (*example with [iproyal rotating residential proxies](https://iproyal.com?r=residential_proxies)*)\n```python3\nfrom searxng_search import SearxngSearch\n\nss = SearxngSearch(proxy=\"socks5h://user:password@geo.iproyal.com:32325\", timeout=20)\nresults = ss.text(\"something you need\")\n```\n*3. The proxy can also be set using the `SEARXNG_PROXY` environment variable.*\n```python3\nexport SEARXNG_PROXY=\"socks5h://user:password@geo.iproyal.com:32325\"\n```\n___\n### Exceptions\n\nExceptions:\n- `SearxngSearchException`: Base exception for searxng_search errors.\n- `RatelimitException`: Inherits from SearxngSearchException, raised for exceeding request rate limits.\n- `TimeoutException`: Inherits from SearxngSearchException, raised for request timeouts.\n___\n### search()\n\n```python\ndef search(\n    self,\n    q: str,\n    language: str = \"auto\",\n    pageno: str | int = 1,\n    time_range: str = \"\",\n    safesearch: str | int = 1,\n) -> list[dict[str, str]]:\n    \"\"\"Searxng search. Query params: https://docs.searxng.org/dev/search_api.html.\n\n    Args:\n        q: search query.\n        language: code of the language. Defaults to \"auto\".\n        pageno: search page number. Defaults to 1.\n        time_range: \"day\", \"week\", \"month\", \"year\". Defaults to \"\".\n        safesearch: 0, 1, 2. Defaults to 1.\n\n    Returns:\n        List of dictionaries with search results.\n```\n***Example***\n```python\nfrom searxng_search import SS  # SS = SearxngSearch (alias)\n\nresults = SS().search(\"python\", language=\"fr\", pageno=4, time_range=\"year\", safesearch=0)\nprint(results)\n```\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Web search using the searxng instances",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/deedy5/searxng_search"
    },
    "split_keywords": [
        "python",
        " searxng"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab86c67abf2a86b40959a361a0a24f3d2abc5cfbc8ea51629f21eab426b6000d",
                "md5": "b1848cad076e63a814ea5e8f63f8deef",
                "sha256": "612031d30aa0f09c89b99a3db717dbacb3a2b9b23f54fc8775592685d5a76fda"
            },
            "downloads": -1,
            "filename": "searxng_search-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b1848cad076e63a814ea5e8f63f8deef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7232,
            "upload_time": "2024-12-28T13:50:55",
            "upload_time_iso_8601": "2024-12-28T13:50:55.174563Z",
            "url": "https://files.pythonhosted.org/packages/ab/86/c67abf2a86b40959a361a0a24f3d2abc5cfbc8ea51629f21eab426b6000d/searxng_search-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fcaca8e686e20f4c57c0742332378e9b6eff2f5ba5dec2b35304c1dac87e3a9b",
                "md5": "b6972176ee6c6b5047210c250eecc832",
                "sha256": "3b8ce0caa4eb472475a108a6263af2f6c04cf9ea05c8e852cba6132fb6fe848e"
            },
            "downloads": -1,
            "filename": "searxng_search-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b6972176ee6c6b5047210c250eecc832",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6755,
            "upload_time": "2024-12-28T13:50:56",
            "upload_time_iso_8601": "2024-12-28T13:50:56.490734Z",
            "url": "https://files.pythonhosted.org/packages/fc/ac/a8e686e20f4c57c0742332378e9b6eff2f5ba5dec2b35304c1dac87e3a9b/searxng_search-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-28 13:50:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "deedy5",
    "github_project": "searxng_search",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "searxng-search"
}
        
Elapsed time: 0.39327s