A package for searching documentation built with sphinx
Project description
Doc-search
A simple package for searching documentation
Features
- Both async and sync support
- utilizes a cache to limit the number of requests being made
- works for any documentation that is built with sphinx
Example
asyncio
import asyncio
from doc_search import AsyncScraper
scraper = AsyncScraper()
async def main(query):
results = await scraper.search(query, page="https://docs.python.org/3/")
#returns a list of tuples in the format of [(item, url), (item, url)...]
if not results:
print("no results were found")
else:
for item, url in results: #loop through the list of results
print(f"{item} | {url}") #print out each result
asyncio.run(main("str.split"))
# to view the cache
# print(scraper.cache)
sync
from doc_search import SyncScraper
scraper = SyncScraper()
results = scraper.search("resize", page="https://pillow.readthedocs.io/en/stable/")
if not results:
print("no results were found")
else:
for item, url in results: #loop through the list of results
print(f"{item} | {url}") #print out each result
Beta
- Offers searches for C and C++ docs using the
scraper.search_c
andscraper.search_cpp
methods EX:scraper = SyncScraper() results = scraper.search_c("printf")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file doc_search-1.0.7-py3-none-any.whl
.
File metadata
- Download URL: doc_search-1.0.7-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd4459f1982f2b750e1304360f1e321b414b8e4cd78635d8c1bda9069f7cd572 |
|
MD5 | c686d77766fe68accc81e09161c13fba |
|
BLAKE2b-256 | ad079462227bcc0bddd8e50b1d215df8ab44ac5038a4332f4639e96edd40f207 |