Skip to main content

searxng-wrapper is a simple Python wrapper for interacting with SearXNG , a privacy-focused meta search engine. This library allows you to perform searches and retrieve structured results easily, without manually handling HTTP requests.

Project description

🕵️‍♂️ searxng-wrapper Documentation

searxng-wrapper is a simple async/sync Python library for interacting with SearXNG, a privacy-respecting metasearch engine that supports JSON-based APIs.

📦 Installation

Install via pip:

pip install searxng-wrapper

To self-host your own SearXNG instance, you can use Docker. Alternatively, use a public instance listed at:

🔗 https://searx.space

🚀 Usage

✅ Async (Recommended)

from searxng_wrapper import SearxngWrapper
import asyncio

async def main():
    client = SearxngWrapper(
        base_url="https://gatotkaca.arosyihuddin.site",
    )

    result = await client.asearch(
        q="SearXNG",
        language="all",
        categories="general"
    )
    print(result)

if __name__ == "__main__":
    asyncio.run(main())

✅ Sync

from searxng_wrapper import SearxngWrapper

if __name__ == "__main__":
    client = SearxngWrapper(
        base_url="https://gatotkaca.arosyihuddin.site",
    )

    result = client.search(
        q="SearXNG",
        language="auto",
        categories="social media",
        safesearch="off"
    )

    print(result)

📌 Important Parameters

Parameter Type Default Description
q str - The search query
language str "auto" Result language ("auto", "en", "id", etc.)
categories str "general" Search category ("general", "science", "it", etc.)
page int 1 Search result page
safesearch str "off" Adult content filter ("off", "moderate", "strict")
time_range str "all" Time range ("day", "week", "month", "year", "all")
max_results int None Return only the top N results from the selected page
enabled_engines List[str] None Force-enable specific search engines
disabled_engines List[str] None Force-disable specific search engines

🛑 Got a 403 Error? Here's the Fix

If you receive a 403 Forbidden error, your SearXNG instance likely does not support JSON requests by default.

✅ How to Enable JSON Support

  1. Open the settings.yml file on your SearXNG server. The file is typically located at:
/etc/searxng/settings.yml
  1. Enable the JSON output format by updating the search: section:
search:
  format:
    - html   # default
    - json   # add this line to enable JSON responses
  1. Save the file and restart your SearXNG instance:
docker restart container_name

📌 Or simply use a public instance that already supports JSON. You can find one at: https://searx.space


🤝 Contributing

Contributions are very welcome! Feel free to fork the repository, submit pull requests for new features, bug fixes, or improvements to this documentation.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

searxng_wrapper-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

searxng_wrapper-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file searxng_wrapper-0.1.0.tar.gz.

File metadata

  • Download URL: searxng_wrapper-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for searxng_wrapper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 29eb1ce5308d8ddb92ebee4f689a51872bf2bee6d92e7334c93d28001f3941ba
MD5 a9e7716a4048ce04540bb62eb088ae77
BLAKE2b-256 3c8ecc715e1f9dfc134a4fd67a179a84927a1381f72993e0911b865587ed6878

See more details on using hashes here.

Provenance

The following attestation bundles were made for searxng_wrapper-0.1.0.tar.gz:

Publisher: python-publish.yml on arosyihuddin/searxng-wrapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file searxng_wrapper-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for searxng_wrapper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb36cc22e5d7005151a51ec8ba01b9b9d472e8b0c32c6f5bcfff705468a8caa8
MD5 570254301c6ac2170b8067af01f492dc
BLAKE2b-256 b71707fd97fcbc36edc530a791fec7a12bdeb4b17649e970973e7b169e695966

See more details on using hashes here.

Provenance

The following attestation bundles were made for searxng_wrapper-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on arosyihuddin/searxng-wrapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page