Simple pure Python Google URL generator based on google(.com) advanced search.
Project description
Google URL Builder.
Simple pure Python Google URL generator based on Google advanced search.
Why?
In some development cases, you may need to generate Google search URLs without the wish to request Google(.com).
In example :
- for displaying/providing those URLs directly to the end user.
- to have more control over what your code makes.
Package principles.
- Pure Python → No more depedencies needed.
- Strong typing.
Examples.
Import package.
from googleurlbuilder import (
GoogleURL,
SearchFilters,
parameters as pr, # Aliases are optionnal.
# Query parameters.
operators as op,
# Operators over query parameters.
filters as ft,
# Filters.
)
Simple use case.
url = GoogleURL((pr.Words(["search", "google"]) + pr.ExactPhrases(["google search"])))
print(url.compute_url())
https://google.com/search?q=%28%28search+google%29+%22google+search%22%29
Use filters.
url = GoogleURL(
query=pr.Words(["search", "google"]),
filters=SearchFilters(language=ft.Languages.French),
tld="fr",
)
print(url.compute_url())
https://google.fr/search?lr=lang_fr&q=%28search+google%29
Use operators over search parameters.
query = op.Or(pr.Words(["search"]), pr.ExactPhrases(["google"]))
print(query)
query = pr.Words(["search"]) | pr.ExactPhrases(["google"]) # equivalent.
print(query)
(search OR "google")
(search OR "google")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
googleurlbuilder-0.1.0.tar.gz
(11.2 kB
view hashes)
Built Distribution
Close
Hashes for googleurlbuilder-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 974aca8f2c2972a1fe444d4a0c56cc27ec0d795a3c8389c0e419ff039da1434c |
|
MD5 | f4c323fa9a752503235f2689e3a6df1c |
|
BLAKE2b-256 | d6cc5fa810bb0d73a49015873a82b87cc40b04a4799711eb79dc01d96ac7d35a |