-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathserps_ready.py
More file actions
30 lines (24 loc) · 905 Bytes
/
serps_ready.py
File metadata and controls
30 lines (24 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
####
## DATAFORSEO SERPS API
##
## Shows number of tasks ready for download
####
import configparser
import argparse
from client import RestClient
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--config', default="config.ini",
type=str, help='Global config file (default: "config.ini")')
args = parser.parse_args()
conf = configparser.ConfigParser()
conf.read(args.config)
user = conf['general']['user']
password = conf['general']['password']
client = RestClient(user,password)
response = client.get("/v3/serp/google/organic/tasks_ready")
if response["status_code"] == 20000:
tasks_available = response["tasks"][0]["result_count"]
print("{} tasks available".format(tasks_available))
else:
print("error. Code: %d Message: %s" % (response["status_code"], response["status_message"]))