direct-cli 0.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- direct_cli/__init__.py +14 -0
- direct_cli/api.py +94 -0
- direct_cli/auth.py +58 -0
- direct_cli/cli.py +85 -0
- direct_cli/commands/__init__.py +61 -0
- direct_cli/commands/adextensions.py +96 -0
- direct_cli/commands/adgroups.py +189 -0
- direct_cli/commands/adimages.py +63 -0
- direct_cli/commands/ads.py +306 -0
- direct_cli/commands/agencyclients.py +64 -0
- direct_cli/commands/audiencetargets.py +187 -0
- direct_cli/commands/bidmodifiers.py +110 -0
- direct_cli/commands/bids.py +108 -0
- direct_cli/commands/businesses.py +61 -0
- direct_cli/commands/campaigns.py +311 -0
- direct_cli/commands/changes.py +97 -0
- direct_cli/commands/clients.py +98 -0
- direct_cli/commands/creatives.py +68 -0
- direct_cli/commands/dictionaries.py +64 -0
- direct_cli/commands/dynamicads.py +104 -0
- direct_cli/commands/feeds.py +99 -0
- direct_cli/commands/keywordbids.py +111 -0
- direct_cli/commands/keywords.py +309 -0
- direct_cli/commands/keywordsresearch.py +71 -0
- direct_cli/commands/leads.py +65 -0
- direct_cli/commands/negativekeywordsharedsets.py +97 -0
- direct_cli/commands/reports.py +128 -0
- direct_cli/commands/retargeting.py +104 -0
- direct_cli/commands/sitelinks.py +92 -0
- direct_cli/commands/smartadtargets.py +104 -0
- direct_cli/commands/turbopages.py +97 -0
- direct_cli/commands/vcards.py +93 -0
- direct_cli/output.py +143 -0
- direct_cli/utils.py +120 -0
- direct_cli-0.0.0.dist-info/METADATA +393 -0
- direct_cli-0.0.0.dist-info/RECORD +39 -0
- direct_cli-0.0.0.dist-info/WHEEL +5 -0
- direct_cli-0.0.0.dist-info/entry_points.txt +2 -0
- direct_cli-0.0.0.dist-info/top_level.txt +1 -0
direct_cli/utils.py
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Utilities for Direct CLI
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import Any, Dict, List, Optional
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def parse_ids(ids_str: Optional[str]) -> Optional[List[int]]:
|
|
11
|
+
"""Parse comma-separated IDs"""
|
|
12
|
+
if not ids_str:
|
|
13
|
+
return None
|
|
14
|
+
result = []
|
|
15
|
+
for x in ids_str.split(","):
|
|
16
|
+
x = x.strip()
|
|
17
|
+
try:
|
|
18
|
+
result.append(int(x))
|
|
19
|
+
except ValueError:
|
|
20
|
+
raise ValueError(f"Invalid ID: '{x}'. IDs must be integers.")
|
|
21
|
+
return result
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def parse_json(json_str: Optional[str]) -> Optional[Dict[str, Any]]:
|
|
25
|
+
"""Parse JSON string"""
|
|
26
|
+
if not json_str:
|
|
27
|
+
return None
|
|
28
|
+
try:
|
|
29
|
+
return json.loads(json_str)
|
|
30
|
+
except json.JSONDecodeError as e:
|
|
31
|
+
raise ValueError(f"Invalid JSON: {e}")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def build_selection_criteria(
|
|
35
|
+
ids: Optional[List[int]] = None,
|
|
36
|
+
status: Optional[str] = None,
|
|
37
|
+
types: Optional[str] = None,
|
|
38
|
+
) -> Optional[Dict[str, Any]]:
|
|
39
|
+
"""Build SelectionCriteria from parameters"""
|
|
40
|
+
criteria = {}
|
|
41
|
+
|
|
42
|
+
if ids:
|
|
43
|
+
criteria["Ids"] = ids
|
|
44
|
+
if status:
|
|
45
|
+
criteria["Statuses"] = [status]
|
|
46
|
+
if types:
|
|
47
|
+
criteria["Types"] = types.split(",")
|
|
48
|
+
|
|
49
|
+
return criteria if criteria else None
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def build_common_params(
|
|
53
|
+
criteria: Optional[Dict[str, Any]] = None,
|
|
54
|
+
field_names: Optional[List[str]] = None,
|
|
55
|
+
limit: Optional[int] = None,
|
|
56
|
+
) -> Dict[str, Any]:
|
|
57
|
+
"""Build common params for get requests"""
|
|
58
|
+
params = {}
|
|
59
|
+
|
|
60
|
+
if criteria:
|
|
61
|
+
params["SelectionCriteria"] = criteria
|
|
62
|
+
if field_names:
|
|
63
|
+
params["FieldNames"] = field_names
|
|
64
|
+
if limit:
|
|
65
|
+
params["Page"] = {"Limit": limit}
|
|
66
|
+
|
|
67
|
+
return params
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def parse_date(date_str: str) -> str:
|
|
71
|
+
"""Parse and validate date string"""
|
|
72
|
+
try:
|
|
73
|
+
datetime.strptime(date_str, "%Y-%m-%d")
|
|
74
|
+
return date_str
|
|
75
|
+
except ValueError:
|
|
76
|
+
raise ValueError(f"Invalid date format: {date_str}. Expected: YYYY-MM-DD")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
COMMON_FIELDS = {
|
|
80
|
+
"campaigns": [
|
|
81
|
+
"Id",
|
|
82
|
+
"Name",
|
|
83
|
+
"Status",
|
|
84
|
+
"State",
|
|
85
|
+
"StartDate",
|
|
86
|
+
"EndDate",
|
|
87
|
+
"Type",
|
|
88
|
+
"DailyBudget",
|
|
89
|
+
"ClientInfo",
|
|
90
|
+
],
|
|
91
|
+
"adgroups": ["Id", "Name", "CampaignId", "Status", "Type", "RegionIds"],
|
|
92
|
+
"ads": ["Id", "CampaignId", "AdGroupId", "Status", "State", "Type"],
|
|
93
|
+
"keywords": [
|
|
94
|
+
"Id",
|
|
95
|
+
"Keyword",
|
|
96
|
+
"CampaignId",
|
|
97
|
+
"AdGroupId",
|
|
98
|
+
"Status",
|
|
99
|
+
"ServingStatus",
|
|
100
|
+
"Bid",
|
|
101
|
+
"ContextBid",
|
|
102
|
+
],
|
|
103
|
+
"clients": ["ClientId", "Login", "CountryId", "Currency"],
|
|
104
|
+
"creatives": ["Id", "Name", "Type"],
|
|
105
|
+
"adimages": ["AdImageHash", "Name"],
|
|
106
|
+
"adextensions": ["Id", "Type", "Status"],
|
|
107
|
+
"sitelinks": ["Id", "Sitelinks"],
|
|
108
|
+
"vcards": ["Id", "CampaignId", "Country", "City", "CompanyName"],
|
|
109
|
+
"leads": ["Date", "LeadId", "CampaignId", "AdGroupId", "AdId"],
|
|
110
|
+
"turbopages": ["Id", "Name", "Status", "Href"],
|
|
111
|
+
"feeds": ["Id", "Name", "Source", "Status"],
|
|
112
|
+
"smartadtargets": ["Id", "CampaignId", "AdGroupId", "Status", "ServingStatus"],
|
|
113
|
+
"businesses": ["Id", "Name", "Url"],
|
|
114
|
+
"retargetinglists": ["Id", "Name", "Type", "Scope"],
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def get_default_fields(resource: str) -> List[str]:
|
|
119
|
+
"""Get default field names for resource"""
|
|
120
|
+
return COMMON_FIELDS.get(resource, ["Id", "Name"])
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: direct-cli
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Command-line interface for Yandex Direct API
|
|
5
|
+
Home-page: https://github.com/pavelmaksimov/direct-cli
|
|
6
|
+
Author: Pavel Maksimov
|
|
7
|
+
Author-email: Pavel Maksimov <vur21@ya.ru>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/pavelmaksimov/direct-cli
|
|
10
|
+
Project-URL: Repository, https://github.com/pavelmaksimov/direct-cli
|
|
11
|
+
Keywords: yandex,direct,cli,api,advertising
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Requires-Python: >=3.6
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: tapi-yandex-direct>=2021.5.29
|
|
25
|
+
Requires-Dist: click>=8.0.0
|
|
26
|
+
Requires-Dist: python-dotenv>=0.19.0
|
|
27
|
+
Requires-Dist: tabulate>=0.8.0
|
|
28
|
+
Requires-Dist: colorama>=0.4.0
|
|
29
|
+
Requires-Dist: tqdm>=4.60.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=2.0; extra == "dev"
|
|
33
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
|
34
|
+
Requires-Dist: flake8>=4.0; extra == "dev"
|
|
35
|
+
Dynamic: author
|
|
36
|
+
Dynamic: home-page
|
|
37
|
+
Dynamic: requires-python
|
|
38
|
+
|
|
39
|
+
# Direct CLI
|
|
40
|
+
|
|
41
|
+
[English](#english) | [Русский](#русский)
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## English
|
|
46
|
+
|
|
47
|
+
Command-line interface for the Yandex Direct API.
|
|
48
|
+
|
|
49
|
+
### Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install direct-cli
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Configuration
|
|
56
|
+
|
|
57
|
+
Create a `.env` file in your working directory:
|
|
58
|
+
|
|
59
|
+
```env
|
|
60
|
+
YANDEX_DIRECT_TOKEN=your_access_token
|
|
61
|
+
YANDEX_DIRECT_LOGIN=your_yandex_login
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or pass credentials directly per command:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
direct-cli --token YOUR_TOKEN --login YOUR_LOGIN campaigns get
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Global Options
|
|
71
|
+
|
|
72
|
+
| Option | Description |
|
|
73
|
+
|--------|-------------|
|
|
74
|
+
| `--token` | API access token |
|
|
75
|
+
| `--login` | Yandex advertiser login |
|
|
76
|
+
| `--sandbox` | Use sandbox API |
|
|
77
|
+
|
|
78
|
+
### Usage
|
|
79
|
+
|
|
80
|
+
All commands follow the pattern: `direct-cli <resource> <action> [options]`
|
|
81
|
+
|
|
82
|
+
#### Campaigns
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Get campaigns
|
|
86
|
+
direct-cli campaigns get
|
|
87
|
+
direct-cli campaigns get --status ACTIVE
|
|
88
|
+
direct-cli campaigns get --ids 1,2,3 --format table
|
|
89
|
+
direct-cli campaigns get --fetch-all --format csv --output campaigns.csv
|
|
90
|
+
|
|
91
|
+
# Create (use --dry-run to preview the request)
|
|
92
|
+
direct-cli campaigns add --name "My Campaign" --start-date 2024-02-01 --type TEXT_CAMPAIGN --budget 1000
|
|
93
|
+
direct-cli campaigns add --name "My Campaign" --start-date 2024-02-01 --dry-run
|
|
94
|
+
|
|
95
|
+
# Update / lifecycle
|
|
96
|
+
direct-cli campaigns update --id 12345 --name "New Name"
|
|
97
|
+
direct-cli campaigns suspend --id 12345
|
|
98
|
+
direct-cli campaigns resume --id 12345
|
|
99
|
+
direct-cli campaigns archive --id 12345
|
|
100
|
+
direct-cli campaigns unarchive --id 12345
|
|
101
|
+
direct-cli campaigns delete --id 12345
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Ad Groups
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
direct-cli adgroups get --campaign-ids 1,2,3 --limit 50
|
|
108
|
+
direct-cli adgroups add --name "Group 1" --campaign-id 12345 --dry-run
|
|
109
|
+
direct-cli adgroups update --id 67890 --name "New Name"
|
|
110
|
+
direct-cli adgroups delete --id 67890
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### Ads
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
direct-cli ads get --campaign-ids 1,2,3
|
|
117
|
+
direct-cli ads get --adgroup-ids 45678 --format table
|
|
118
|
+
direct-cli ads add --adgroup-id 12345 --type TEXT_AD --title "Title" --text "Ad text" --href "https://example.com" --dry-run
|
|
119
|
+
direct-cli ads update --id 99999 --status PAUSED
|
|
120
|
+
direct-cli ads delete --id 99999
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Keywords
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
direct-cli keywords get --campaign-ids 1,2,3
|
|
127
|
+
direct-cli keywords add --adgroup-id 12345 --keyword "buy laptop" --bid 10.50 --dry-run
|
|
128
|
+
direct-cli keywords update --id 88888 --bid 15.00
|
|
129
|
+
direct-cli keywords delete --id 88888
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### Reports
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Get a report (saved to file)
|
|
136
|
+
direct-cli reports get \
|
|
137
|
+
--type CAMPAIGN_PERFORMANCE_REPORT \
|
|
138
|
+
--from 2024-01-01 --to 2024-01-31 \
|
|
139
|
+
--name "January Report" \
|
|
140
|
+
--fields "Date,CampaignId,Clicks,Cost" \
|
|
141
|
+
--format csv --output report.csv
|
|
142
|
+
|
|
143
|
+
# List available report types
|
|
144
|
+
direct-cli reports list-types
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Available report types: `CAMPAIGN_PERFORMANCE_REPORT`, `ADGROUP_PERFORMANCE_REPORT`, `AD_PERFORMANCE_REPORT`, `CRITERIA_PERFORMANCE_REPORT`, `CUSTOM_REPORT`, `REACH_AND_FREQUENCY_CAMPAIGN_REPORT`, `SEARCH_QUERY_PERFORMANCE_REPORT`
|
|
148
|
+
|
|
149
|
+
#### Other Resources
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Reference dictionaries
|
|
153
|
+
direct-cli dictionaries get --names Currencies,GeoRegions
|
|
154
|
+
|
|
155
|
+
# Client info
|
|
156
|
+
direct-cli clients get --fields ClientId,Login,Currency
|
|
157
|
+
|
|
158
|
+
# Changes feed
|
|
159
|
+
direct-cli changes get --campaign-ids 1,2,3
|
|
160
|
+
|
|
161
|
+
# Retargeting lists
|
|
162
|
+
direct-cli retargeting get --limit 10
|
|
163
|
+
|
|
164
|
+
# Ad extensions, sitelinks, vCards, images, creatives, feeds, bids, etc.
|
|
165
|
+
direct-cli adextensions get
|
|
166
|
+
direct-cli sitelinks get --ids 1,2,3
|
|
167
|
+
direct-cli bids get --campaign-ids 1,2,3
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Output Formats
|
|
171
|
+
|
|
172
|
+
All `get` commands support `--format`:
|
|
173
|
+
|
|
174
|
+
| Format | Description |
|
|
175
|
+
|--------|-------------|
|
|
176
|
+
| `json` | JSON (default) |
|
|
177
|
+
| `table` | Formatted table |
|
|
178
|
+
| `csv` | CSV |
|
|
179
|
+
| `tsv` | TSV |
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
direct-cli campaigns get --format table
|
|
183
|
+
direct-cli campaigns get --format csv --output campaigns.csv
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Pagination
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
direct-cli campaigns get --limit 10 # first 10 results
|
|
190
|
+
direct-cli campaigns get --fetch-all # all pages
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### ⚠️ Destructive Commands
|
|
194
|
+
|
|
195
|
+
The following commands make **irreversible changes** — use with caution:
|
|
196
|
+
|
|
197
|
+
| Command | Effect |
|
|
198
|
+
|---------|--------|
|
|
199
|
+
| `campaigns delete --id` | Permanently deletes a campaign and all its contents |
|
|
200
|
+
| `adgroups delete --id` | Permanently deletes an ad group |
|
|
201
|
+
| `ads delete --id` | Permanently deletes an ad |
|
|
202
|
+
| `keywords delete --id` | Permanently deletes a keyword |
|
|
203
|
+
| `audiencetargets delete --id` | Permanently deletes an audience target |
|
|
204
|
+
|
|
205
|
+
Commands that affect live ad delivery: `suspend`, `resume`, `archive`, `unarchive` (available on `campaigns`, `ads`, `keywords`).
|
|
206
|
+
|
|
207
|
+
Commands that affect bids and spending: `bids set`, `keywordbids set`, `bidmodifiers set`.
|
|
208
|
+
|
|
209
|
+
Use `--dry-run` on `add` / `update` commands to preview the API request before sending:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
direct-cli campaigns add --name "Test" --start-date 2024-01-01 --dry-run
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### License
|
|
216
|
+
|
|
217
|
+
MIT
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Русский
|
|
222
|
+
|
|
223
|
+
Интерфейс командной строки для Яндекс.Директ API.
|
|
224
|
+
|
|
225
|
+
### Установка
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
pip install direct-cli
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Настройка
|
|
232
|
+
|
|
233
|
+
Создайте файл `.env` в рабочей директории:
|
|
234
|
+
|
|
235
|
+
```env
|
|
236
|
+
YANDEX_DIRECT_TOKEN=ваш_токен
|
|
237
|
+
YANDEX_DIRECT_LOGIN=ваш_логин_на_яндексе
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Или передавайте credentials напрямую в команду:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
direct-cli --token ВАШ_ТОКЕН --login ВАШ_ЛОГИН campaigns get
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Глобальные опции
|
|
247
|
+
|
|
248
|
+
| Опция | Описание |
|
|
249
|
+
|-------|----------|
|
|
250
|
+
| `--token` | OAuth-токен доступа к API |
|
|
251
|
+
| `--login` | Логин рекламодателя на Яндексе |
|
|
252
|
+
| `--sandbox` | Использовать тестовое API (песочница) |
|
|
253
|
+
|
|
254
|
+
### Использование
|
|
255
|
+
|
|
256
|
+
Все команды следуют шаблону: `direct-cli <ресурс> <действие> [опции]`
|
|
257
|
+
|
|
258
|
+
#### Кампании
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
# Получить кампании
|
|
262
|
+
direct-cli campaigns get
|
|
263
|
+
direct-cli campaigns get --status ACTIVE
|
|
264
|
+
direct-cli campaigns get --ids 1,2,3 --format table
|
|
265
|
+
direct-cli campaigns get --fetch-all --format csv --output campaigns.csv
|
|
266
|
+
|
|
267
|
+
# Создать (--dry-run покажет запрос без отправки)
|
|
268
|
+
direct-cli campaigns add --name "Моя кампания" --start-date 2024-02-01 --type TEXT_CAMPAIGN --budget 1000
|
|
269
|
+
direct-cli campaigns add --name "Моя кампания" --start-date 2024-02-01 --dry-run
|
|
270
|
+
|
|
271
|
+
# Обновление и управление статусом
|
|
272
|
+
direct-cli campaigns update --id 12345 --name "Новое название"
|
|
273
|
+
direct-cli campaigns suspend --id 12345
|
|
274
|
+
direct-cli campaigns resume --id 12345
|
|
275
|
+
direct-cli campaigns archive --id 12345
|
|
276
|
+
direct-cli campaigns unarchive --id 12345
|
|
277
|
+
direct-cli campaigns delete --id 12345
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### Группы объявлений
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
direct-cli adgroups get --campaign-ids 1,2,3 --limit 50
|
|
284
|
+
direct-cli adgroups add --name "Группа 1" --campaign-id 12345 --dry-run
|
|
285
|
+
direct-cli adgroups update --id 67890 --name "Новое название"
|
|
286
|
+
direct-cli adgroups delete --id 67890
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
#### Объявления
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
direct-cli ads get --campaign-ids 1,2,3
|
|
293
|
+
direct-cli ads get --adgroup-ids 45678 --format table
|
|
294
|
+
direct-cli ads add --adgroup-id 12345 --type TEXT_AD --title "Заголовок" --text "Текст объявления" --href "https://example.com" --dry-run
|
|
295
|
+
direct-cli ads update --id 99999 --status PAUSED
|
|
296
|
+
direct-cli ads delete --id 99999
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
#### Ключевые слова
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
direct-cli keywords get --campaign-ids 1,2,3
|
|
303
|
+
direct-cli keywords add --adgroup-id 12345 --keyword "купить ноутбук" --bid 10.50 --dry-run
|
|
304
|
+
direct-cli keywords update --id 88888 --bid 15.00
|
|
305
|
+
direct-cli keywords delete --id 88888
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
#### Отчёты
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
# Сформировать отчёт (сохраняется в файл)
|
|
312
|
+
direct-cli reports get \
|
|
313
|
+
--type CAMPAIGN_PERFORMANCE_REPORT \
|
|
314
|
+
--from 2024-01-01 --to 2024-01-31 \
|
|
315
|
+
--name "Отчёт за январь" \
|
|
316
|
+
--fields "Date,CampaignId,Clicks,Cost" \
|
|
317
|
+
--format csv --output report.csv
|
|
318
|
+
|
|
319
|
+
# Список доступных типов отчётов
|
|
320
|
+
direct-cli reports list-types
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Доступные типы: `CAMPAIGN_PERFORMANCE_REPORT`, `ADGROUP_PERFORMANCE_REPORT`, `AD_PERFORMANCE_REPORT`, `CRITERIA_PERFORMANCE_REPORT`, `CUSTOM_REPORT`, `REACH_AND_FREQUENCY_CAMPAIGN_REPORT`, `SEARCH_QUERY_PERFORMANCE_REPORT`
|
|
324
|
+
|
|
325
|
+
#### Другие ресурсы
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
# Справочники
|
|
329
|
+
direct-cli dictionaries get --names Currencies,GeoRegions
|
|
330
|
+
|
|
331
|
+
# Информация о клиенте
|
|
332
|
+
direct-cli clients get --fields ClientId,Login,Currency
|
|
333
|
+
|
|
334
|
+
# Лента изменений
|
|
335
|
+
direct-cli changes get --campaign-ids 1,2,3
|
|
336
|
+
|
|
337
|
+
# Списки ретаргетинга
|
|
338
|
+
direct-cli retargeting get --limit 10
|
|
339
|
+
|
|
340
|
+
# Расширения объявлений, быстрые ссылки, визитки, изображения, ставки и т.д.
|
|
341
|
+
direct-cli adextensions get
|
|
342
|
+
direct-cli sitelinks get --ids 1,2,3
|
|
343
|
+
direct-cli bids get --campaign-ids 1,2,3
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Форматы вывода
|
|
347
|
+
|
|
348
|
+
Все команды `get` поддерживают `--format`:
|
|
349
|
+
|
|
350
|
+
| Формат | Описание |
|
|
351
|
+
|--------|----------|
|
|
352
|
+
| `json` | JSON (по умолчанию) |
|
|
353
|
+
| `table` | Таблица |
|
|
354
|
+
| `csv` | CSV |
|
|
355
|
+
| `tsv` | TSV |
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
direct-cli campaigns get --format table
|
|
359
|
+
direct-cli campaigns get --format csv --output campaigns.csv
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Пагинация
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
direct-cli campaigns get --limit 10 # первые 10 результатов
|
|
366
|
+
direct-cli campaigns get --fetch-all # все страницы
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### ⚠️ Опасные команды
|
|
370
|
+
|
|
371
|
+
Следующие команды вносят **необратимые изменения** — используйте осторожно:
|
|
372
|
+
|
|
373
|
+
| Команда | Эффект |
|
|
374
|
+
|---------|--------|
|
|
375
|
+
| `campaigns delete --id` | Безвозвратно удаляет кампанию и весь её контент |
|
|
376
|
+
| `adgroups delete --id` | Безвозвратно удаляет группу объявлений |
|
|
377
|
+
| `ads delete --id` | Безвозвратно удаляет объявление |
|
|
378
|
+
| `keywords delete --id` | Безвозвратно удаляет ключевое слово |
|
|
379
|
+
| `audiencetargets delete --id` | Безвозвратно удаляет условие подбора аудитории |
|
|
380
|
+
|
|
381
|
+
Команды, влияющие на показ рекламы: `suspend`, `resume`, `archive`, `unarchive` (доступны для `campaigns`, `ads`, `keywords`).
|
|
382
|
+
|
|
383
|
+
Команды, влияющие на ставки и расходы: `bids set`, `keywordbids set`, `bidmodifiers set`.
|
|
384
|
+
|
|
385
|
+
Используйте `--dry-run` в командах `add` / `update`, чтобы увидеть тело запроса до отправки:
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
direct-cli campaigns add --name "Тест" --start-date 2024-01-01 --dry-run
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Лицензия
|
|
392
|
+
|
|
393
|
+
MIT
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
direct_cli/__init__.py,sha256=eABq4p8Yh-Ia1sfr6tvAalkJnY6SRRHmugJ8X2s-7QA,320
|
|
2
|
+
direct_cli/api.py,sha256=Dbyi_9F1WnwDOMAmPeUOajL0bQffAR1s5qYwsMioWR4,2272
|
|
3
|
+
direct_cli/auth.py,sha256=83w9InfmOqZa0mPbtwkf4pS8BPn-fDJCDhjZWNKwUkM,1371
|
|
4
|
+
direct_cli/cli.py,sha256=AOQf48jkR_0yU2ubAy5Bv_bw_GQblFEOevjC0FtpRDc,2632
|
|
5
|
+
direct_cli/output.py,sha256=aA8-BS6OjzMplRjhqDiHfEUZBa1USfE2-dAJezQI5yQ,4118
|
|
6
|
+
direct_cli/utils.py,sha256=lES9tvDTWdhS10KsU74tazwbPIcEZN8mMKKlnBXJQ_c,3261
|
|
7
|
+
direct_cli/commands/__init__.py,sha256=WHvXUd_dgpx1VR91T3dBWp2BCIEwdh17txYjNQTGrmM,1475
|
|
8
|
+
direct_cli/commands/adextensions.py,sha256=41UOK8bwwkIaZ5XV_qbzmHZl9-tDoHmrjaLVF3GXGI4,2830
|
|
9
|
+
direct_cli/commands/adgroups.py,sha256=HPcClDcrUwpe7sZeDXwWRoBOGbamZA69w1f9gRxmlE8,5518
|
|
10
|
+
direct_cli/commands/adimages.py,sha256=Wl4d5BVBM4arxrlmWuetgqBHbrsKd8uuBUNcAAmP62M,1734
|
|
11
|
+
direct_cli/commands/ads.py,sha256=USazYe8aXEPuji5py2HxUUGRvQ_2ajBv7eU7v4dmcNA,8509
|
|
12
|
+
direct_cli/commands/agencyclients.py,sha256=ZW35X3reash0cpp0TWFjoVJ1HXWN-IVyaNigic2rDdY,1799
|
|
13
|
+
direct_cli/commands/audiencetargets.py,sha256=tLOP-xFIbwzoU6UOkA3ocF2GYrnrfpUGWm1_80Eqnms,5447
|
|
14
|
+
direct_cli/commands/bidmodifiers.py,sha256=Neg2cBTvDOdcuiBbnS5DfW3-jaaPI8eOUa7zJ7bBRZM,3233
|
|
15
|
+
direct_cli/commands/bids.py,sha256=HFbROs7XGl0W8oZEdqjuizFK9VqBxnxB-ef-LnSmXWo,3105
|
|
16
|
+
direct_cli/commands/businesses.py,sha256=qlltQOLco5nkflSJkQoLvRb2APBsvi4ImKjRnes8gwE,1705
|
|
17
|
+
direct_cli/commands/campaigns.py,sha256=Za3CRSthI5-jRinIw3gJJcrQUmfNI_B-VAdTpi4gmyg,9016
|
|
18
|
+
direct_cli/commands/changes.py,sha256=WuxrXjW2V7RTGgOZea4VeErJOmRrPN6u8c9685rF4K4,2745
|
|
19
|
+
direct_cli/commands/clients.py,sha256=JQgqmXWQh-zDKlKOVe9dtetALFy90L7NaelWLsJaiH0,2773
|
|
20
|
+
direct_cli/commands/creatives.py,sha256=NHKjcw_XyiQhc1X2dbCCDdJ361FcEEs9IGpXkrfjYX0,1942
|
|
21
|
+
direct_cli/commands/dictionaries.py,sha256=q_dLWJ2IN51qGVRl1-HitK6uxb-44gmKb19odoy2E7Y,1475
|
|
22
|
+
direct_cli/commands/dynamicads.py,sha256=AXQIOD6mPFzAP6MYAyFzwqAycURenO5_LiSJR-1WgmY,3117
|
|
23
|
+
direct_cli/commands/feeds.py,sha256=MmUAjrWCZ7NociDrQRoMA5JtSfg2RSsYOFDXuTmxTw4,2759
|
|
24
|
+
direct_cli/commands/keywordbids.py,sha256=2WZ3_xtsHZXP3ECcIljTh55WTWnq6kCM22zCOIX05SY,3385
|
|
25
|
+
direct_cli/commands/keywords.py,sha256=qZlZypAkXSbVDlyKume9OhiJ7AHWkWkbw40BshIkuKI,8795
|
|
26
|
+
direct_cli/commands/keywordsresearch.py,sha256=n-YyFHF5Cc51F0nGNqk8XrIDZHsZwuq9c18ImqF4lMc,2065
|
|
27
|
+
direct_cli/commands/leads.py,sha256=QOIb6CCFOQUx1mHOxCqyPIdFwL82mazaM6YXZH-fiPI,1799
|
|
28
|
+
direct_cli/commands/negativekeywordsharedsets.py,sha256=9kusSNcQ_Yt8UYJyZZI6GC2P4seXQTz00ThrfYWbB08,2906
|
|
29
|
+
direct_cli/commands/reports.py,sha256=vKlQ2yNAveJETe86qNse48gh3P8ybVS0x7F9f4B9rGs,3592
|
|
30
|
+
direct_cli/commands/retargeting.py,sha256=lnHa4M5tlmCxu9W2dZcj6MrqWb7sOm6vO8hjI4numfc,3054
|
|
31
|
+
direct_cli/commands/sitelinks.py,sha256=sdL9PPrWCyHs7UMlETKv7IemohbsM8HPym9b8llsVAc,2548
|
|
32
|
+
direct_cli/commands/smartadtargets.py,sha256=tt910yiDjcYuWmNTf6rBhJxEJfq8j0ErP3HOz4qsTuM,3146
|
|
33
|
+
direct_cli/commands/turbopages.py,sha256=NnwXYGQu0h9rwbUNExxIu1jr8QaiNCmCymmiiYBlyuE,2790
|
|
34
|
+
direct_cli/commands/vcards.py,sha256=E_zeg7VadIp1iAeMaLCQsI81ebGJSY_gVBW_XB9hAzc,2557
|
|
35
|
+
direct_cli-0.0.0.dist-info/METADATA,sha256=pnRdEw9eVXUjmQSB8adw9YeyorxThhj6JmEuYSfWFh0,12174
|
|
36
|
+
direct_cli-0.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
37
|
+
direct_cli-0.0.0.dist-info/entry_points.txt,sha256=yzCDa9Tum04gxxdx5DkyX1ArWrXWrr4PAclLQOmA_54,50
|
|
38
|
+
direct_cli-0.0.0.dist-info/top_level.txt,sha256=M8w4K7buiy4QuvlN4gU2c47HAO0zPmuTGIoWk0kWEEM,11
|
|
39
|
+
direct_cli-0.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
direct_cli
|