Skip to content

Commit 3792912

Browse files
change timeout to seconds
1 parent 936f201 commit 3792912

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

serpapi/serp_api_client.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ class SerpApiClient(object):
99
"""SerpApiClient enables to query any search engines supported by SerpApi and parse the results.
1010
```python
1111
from serpapi import GoogleSearch
12-
search = SerpApiClient({
13-
"q": "Coffee",
14-
"location": "Austin,Texas",
15-
"engine": "google",
16-
"api_key": "<your private key>"
17-
})
12+
search = SerpApiClient(
13+
{
14+
"q": "Coffee",
15+
"location": "Austin,Texas",
16+
"engine": "google",
17+
"api_key": "<your private key>",
18+
},
19+
timeout = 60,
20+
)
1821
data = search.get_json()
1922
```
2023
@@ -24,7 +27,7 @@ class SerpApiClient(object):
2427
BACKEND = "https://serpapi.com"
2528
SERP_API_KEY = None
2629

27-
def __init__(self, params_dict, engine = None, timeout = 60000):
30+
def __init__(self, params_dict, engine = None, timeout = 60):
2831
self.params_dict = params_dict
2932
self.engine = engine
3033
self.timeout = timeout
@@ -47,7 +50,6 @@ def get_response(self, path = '/search'):
4750
url = None
4851
try:
4952
url, parameter = self.construct_url(path)
50-
# print(url)
5153
response = requests.get(url, parameter, timeout=self.timeout)
5254
return response
5355
except requests.HTTPError as e:

0 commit comments

Comments
 (0)