Skip to content

Commit

Permalink
V3.1.0 (#71)
Browse files Browse the repository at this point in the history
1.    added anti_useragent to generate random headers
2.    refactored code
3.    corrected type hints
  • Loading branch information
deedy5 authored May 21, 2023
1 parent fb08929 commit 54ace2e
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 156 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,29 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']

python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
python -m pip install --upgrade flake8 pytest isort black
- name: temp
run: |
pip install requests click diskcache
python -m pip install flake8 pytest isort black
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 duckduckgo_search --count --select=E9,F63,F7,F82 --show-source --statistics --ignore=E999
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --ignore=E999
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 duckduckgo_search --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore=E999
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore=E999
- name: Test with pytest
run: |
pytest
- name: isort
run: |
isort duckduckgo_search --profile black --check
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def text(
region: str = "wt-wt",
safesearch: str = "moderate",
timelimit: Optional[str] = None,
) -> Generator[dict, None, None]:
) -> Iterator[dict]:
"""DuckDuckGo text search generator. Query params: https://duckduckgo.com/params
Args:
Expand Down Expand Up @@ -253,7 +253,7 @@ def images(
type_image: Optional[str] = None,
layout: Optional[str] = None,
license_image: Optional[str] = None,
) -> Generator[dict, None, None]:
) -> Iterator[dict]:
"""DuckDuckGo images search. Query params: https://duckduckgo.com/params
Args:
Expand Down Expand Up @@ -311,7 +311,7 @@ def videos(
resolution: Optional[str] = None,
duration: Optional[str] = None,
license_videos: Optional[str] = None,
) -> Generator[dict, None, None]:
) -> Iterator[dict]:
"""DuckDuckGo videos search. Query params: https://duckduckgo.com/params
Args:
Expand Down Expand Up @@ -358,7 +358,7 @@ def news(
region: str = "wt-wt",
safesearch: str = "moderate",
timelimit: Optional[str] = None,
) -> Generator[dict, None, None]:
) -> Iterator[dict]:
"""DuckDuckGo news search. Query params: https://duckduckgo.com/params
Args:
Expand Down Expand Up @@ -406,7 +406,7 @@ def maps(
latitude: Optional[str] = None,
longitude: Optional[str] = None,
radius: int = 0,
) -> Generator[dict, None, None]:
) -> Iterator[dict]:
"""DuckDuckGo maps search. Query params: https://duckduckgo.com/params
Args:
Expand Down Expand Up @@ -485,7 +485,7 @@ print(r)
def suggestions(
keywords,
region: str = "wt-wt",
) -> Generator[dict, None, None]:
) -> Iterator[dict]:
"""DuckDuckGo suggestions. Query params: https://duckduckgo.com/params
Args:
Expand Down
Loading

0 comments on commit 54ace2e

Please sign in to comment.