You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/index.rst
+40-22Lines changed: 40 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,6 @@ an official Python client library for `SerpApi <https://serpapi.com>`_.
10
10
11
11
--------------
12
12
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
-
21
13
Installation
22
14
------------
23
15
@@ -53,8 +45,31 @@ To make this less repetitive, and gain the benefit of connection pooling, let's
53
45
The ``api_key`` parameter is now automatically passed to all requests made by the client.
54
46
55
47
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
+
56
71
API Reference
57
-
=============
72
+
-------------
58
73
59
74
.. _api-reference:
60
75
@@ -71,19 +86,6 @@ This part of the documentation covers all the interfaces of :class:`serpapi` Pyt
71
86
.. autofunction:: serpapi.locations
72
87
.. autofunction:: serpapi.account
73
88
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
87
89
88
90
89
91
Results from SerpApi.com
@@ -141,6 +143,22 @@ Here's documentation of the class itself and its methods:
141
143
.. autoproperty:: SerpResults.next_page_url
142
144
143
145
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.
0 commit comments