Skip to content

Commit 4212fe4

Browse files
committed
readthedocs
1 parent a2a89dd commit 4212fe4

4 files changed

Lines changed: 127 additions & 22 deletions

File tree

.readthedocs.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
# You can also specify other tool versions:
14+
# nodejs: "19"
15+
# rust: "1.64"
16+
# golang: "1.19"
17+
18+
# Build documentation in the "docs/" directory with Sphinx
19+
sphinx:
20+
configuration: docs/conf.py
21+
22+
# Optionally build your docs in additional formats such as PDF and ePub
23+
formats:
24+
- pdf
25+
- epub
26+
27+
# Optional but recommended, declare the Python requirements required
28+
# to build your documentation
29+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
30+
python:
31+
install:
32+
- requirements: docs/requirements.txt

docs/requirements.txt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
alabaster==0.7.13
2+
astroid==2.15.5
3+
Babel==2.12.1
4+
bleach==6.0.0
5+
certifi==2023.5.7
6+
charset-normalizer==3.2.0
7+
coverage==7.2.7
8+
dill==0.3.6
9+
docutils==0.20.1
10+
idna==3.4
11+
imagesize==1.4.1
12+
importlib-metadata==6.7.0
13+
iniconfig==2.0.0
14+
isort==5.12.0
15+
jaraco.classes==3.2.3
16+
Jinja2==3.1.2
17+
keyring==24.2.0
18+
lazy-object-proxy==1.9.0
19+
markdown-it-py==3.0.0
20+
MarkupSafe==2.1.3
21+
mccabe==0.7.0
22+
mdurl==0.1.2
23+
more-itertools==9.1.0
24+
packaging==23.1
25+
pkginfo==1.9.6
26+
platformdirs==3.8.0
27+
pluggy==1.2.0
28+
pycodestyle==2.10.0
29+
Pygments==2.15.1
30+
pylint==2.17.4
31+
pytest==7.4.0
32+
pytest-cov==4.1.0
33+
readme-renderer==40.0
34+
requests==2.31.0
35+
requests-toolbelt==1.0.0
36+
rfc3986==2.0.0
37+
rich==13.4.2
38+
-e git+ssh://git@github.com/serpapi/serpapi-python.git@a2a89dd36c6d81dc61e77cf0e4e35203d50d3af1#egg=serpapi
39+
six==1.16.0
40+
snowballstemmer==2.2.0
41+
Sphinx==7.0.1
42+
sphinxcontrib-applehelp==1.0.4
43+
sphinxcontrib-devhelp==1.0.2
44+
sphinxcontrib-htmlhelp==2.0.1
45+
sphinxcontrib-jsmath==1.0.1
46+
sphinxcontrib-qthelp==1.0.3
47+
sphinxcontrib-serializinghtml==1.1.5
48+
tomlkit==0.11.8
49+
twine==4.0.2
50+
urllib3==2.0.3
51+
webencodings==0.5.1
52+
wrapt==1.15.0
53+
zipp==3.15.0

docs/source/index.rst

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ an official Python client library for `SerpApi <https://serpapi.com>`_.
1010

1111
--------------
1212

13-
Getting Started
14-
===============
15-
16-
This part of the documentation covers installation of `serpapi-python` and a quick tutorial to get you started.
17-
18-
If you are looking for reference material, please see the :ref:`API Reference <api-reference>`.
19-
20-
2113
Installation
2214
------------
2315

@@ -53,8 +45,31 @@ To make this less repetitive, and gain the benefit of connection pooling, let's
5345
The ``api_key`` parameter is now automatically passed to all requests made by the client.
5446

5547

48+
Concise Tutorial
49+
----------------
50+
51+
Let's start by searching for ``Coffee`` on Google::
52+
53+
>>> import serpapi
54+
>>> s = serpapi.search(q="Coffee", engine="google", location="Austin, Texas", hl="en", gl="us")
55+
56+
The ``s`` variable now contains a :class:`SerpResults <serpapi.SerpResults>` object, which acts just like a standard dictionary, with some convenient functions added on top.
57+
58+
Let's print the first result::
59+
60+
>>> print(s["organic_results"][0]["link"])
61+
https://en.wikipedia.org/wiki/Coffee
62+
63+
Let's print the title of the first result, but in a more Pythonic way::
64+
65+
>>> print(s["organic_results"][0].get("title"))
66+
Coffee - Wikipedia
67+
68+
The `SerpApi.com API Documentation <https://serpapi.com/search-api>`_ contains a list of all the possible parameters that can be passed to the API.
69+
70+
5671
API Reference
57-
=============
72+
-------------
5873

5974
.. _api-reference:
6075

@@ -71,19 +86,6 @@ This part of the documentation covers all the interfaces of :class:`serpapi` Pyt
7186
.. autofunction:: serpapi.locations
7287
.. autofunction:: serpapi.account
7388

74-
API Client
75-
----------
76-
77-
The primary interface to `serpapi-python` is through the :class:`serpapi.Client` class.
78-
The primary benefit of using this class is to benefit from Requests' HTTP Connection Pooling.
79-
This class also alleviates the need to pass an ``api_key``` along with every search made to the platform.
80-
81-
.. autoclass:: serpapi.Client
82-
83-
.. automethod:: Client.search
84-
.. automethod:: Client.search_archive
85-
.. automethod:: Client.account
86-
.. automethod:: Client.locations
8789

8890

8991
Results from SerpApi.com
@@ -141,6 +143,22 @@ Here's documentation of the class itself and its methods:
141143
.. autoproperty:: SerpResults.next_page_url
142144

143145

146+
API Client
147+
----------
148+
149+
The primary interface to `serpapi-python` is through the :class:`serpapi.Client` class.
150+
The primary benefit of using this class is to benefit from Requests' HTTP Connection Pooling.
151+
This class also alleviates the need to pass an ``api_key``` along with every search made to the platform.
152+
153+
.. autoclass:: serpapi.Client
154+
155+
.. automethod:: Client.search
156+
.. automethod:: Client.search_archive
157+
.. automethod:: Client.account
158+
.. automethod:: Client.locations
159+
160+
161+
144162
Exceptions
145163
----------
146164

serpapi/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class Client(HTTPClient):
2323
2424
"""
2525

26+
DASHBOARD_URL = "https://serpapi.com/dashboard"
27+
2628
def __repr__(self):
2729
return "<SerpApi Client>"
2830

0 commit comments

Comments
 (0)