@@ -4,29 +4,33 @@ A simple Python client example to send requests and get results from [DataForSEO
4
4
5
5
## Setup
6
6
7
- 1 . Clone this repo:
7
+ __ 1 . Clone this repo:__
8
8
9
- $ git clone git@gitlab.com : databulle /dataforseo-serp-api-python-client.git
9
+ $ git clone git@gitlab.com:databulle/dataforseo-serp-api-python-client.git
10
10
$ cd dataforseo-serp-api-python-client
11
11
12
- 2 . (Optional) Setup a new [ pyenv] ( https://github.com/pyenv/pyenv ) virtual environment:
13
12
14
- $ pyenv virtualenv 3.7.0 dataforseo
13
+ __ 2. (Optional) Setup a new [ pyenv] ( https://github.com/pyenv/pyenv ) virtual environment:__
14
+
15
+ $ pyenv virtualenv 3.7.0 dataforseo
15
16
$ pyenv local dataforseo
16
17
17
- 3 . Get your credentials from DataForSEO:
18
+
19
+ __ 3. Get your credentials from DataForSEO:__
18
20
19
21
Go to [ the API dashboard] ( https://app.dataforseo.com/api-dashboard ) and get your ` API Login ` and ` API Password ` .
20
22
21
- 4 . Create you ` config.ini ` file:
23
+
24
+ __ 4. Create you ` config.ini ` file:__
22
25
23
26
Copy the sample config file:
24
27
25
28
$ cp config.sample.ini config.ini
26
29
27
30
Edit the new file and fill in your login and password
28
31
29
- 5 . That's all!
32
+
33
+ __ 5. That's all!__
30
34
31
35
### Sandbox
32
36
@@ -46,6 +50,26 @@ Remember to switch it back when things get real ;)
46
50
47
51
### 1. Post tasks
48
52
53
+ Put the list of keywords in a text file (one request per line), then run:
54
+
55
+ $ python tasks_post.py --input yourfile.txt
56
+
57
+ The script will send the keywords to the API by batches of 100 requests, and write a report containing the ` task_id ` for each keyword.
58
+
59
+ The ` input ` argument is required. Other options are available:
60
+ - ` config ` : configuration file to use (default: ` config.ini ` )
61
+ - ` input ` : input file with the list of requests (required)
62
+ - ` output ` : output basename for the report (default: ` keyword-requests ` )
63
+ - ` language_code ` : language code for the requests (default: ` fr ` )
64
+ - ` location_code ` : location code for requests (default: "2250" for France, get other codes on < https://api.dataforseo.com/v3/serp/google/locations > )
65
+ - ` nb_results ` : number of results to ask for (default: ` 10 ` )
66
+ - ` device ` : choice between ` desktop ` (default) and ` mobile `
67
+ - ` priority ` : choose the priority queue between ` low ` (default) and ` high ` (note: ` high ` priority requests will be charged more by DataForSEO)
68
+ - ` batch ` : number of requests to send for each batch, between 1 and 100 (default: ` 100 ` )
69
+ - ` delay ` : delay in seconds between batches of requests (default: ` 10 ` )
70
+ - ` sep ` : CSV separator for ` output ` (default: ` ; ` )
71
+
72
+
49
73
### 2. See if tasks are ready
50
74
51
75
This step is not required, but will show you how many of your requests have been processed and are available for download.
0 commit comments