logos-sdk 0.0.25.dev12__tar.gz → 0.0.25.dev14__tar.gz
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.
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/PKG-INFO +3 -2
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/big_query/BigQuery.py +50 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/MicrosoftAdvertising.py +79 -14
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk.egg-info/PKG-INFO +3 -2
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/LICENSE +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/README.md +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/__init__.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/big_query/__init__.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/logging/LogosLogger.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/logging/__init__.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/CampaignManager.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/Collabim.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/DV360.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/Facebook.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/GoogleAds.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/GoogleSheets.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/MarketMiner.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/MerchantCenter.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/Sklik.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/__init__.py +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk.egg-info/SOURCES.txt +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk.egg-info/dependency_links.txt +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk.egg-info/requires.txt +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk.egg-info/top_level.txt +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/setup.cfg +0 -0
- {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: logos-sdk
|
|
3
|
-
Version: 0.0.25.
|
|
3
|
+
Version: 0.0.25.dev14
|
|
4
4
|
Summary: SDK for Logos platform
|
|
5
5
|
Home-page: https://bitbucket.org/databy/logos-sdk-pip/src/master/
|
|
6
6
|
Author: Databy.io
|
|
@@ -25,6 +25,7 @@ Dynamic: classifier
|
|
|
25
25
|
Dynamic: description
|
|
26
26
|
Dynamic: description-content-type
|
|
27
27
|
Dynamic: home-page
|
|
28
|
+
Dynamic: license-file
|
|
28
29
|
Dynamic: requires-dist
|
|
29
30
|
Dynamic: summary
|
|
30
31
|
|
|
@@ -88,6 +88,27 @@ class BigQuery:
|
|
|
88
88
|
|
|
89
89
|
self._insert_into_table(bq_table, records)
|
|
90
90
|
|
|
91
|
+
def insert_create_partitioned_table(
|
|
92
|
+
self,
|
|
93
|
+
dataset_id: str,
|
|
94
|
+
table_id: str,
|
|
95
|
+
records: List[Dict],
|
|
96
|
+
schema_columns: List[Dict],
|
|
97
|
+
partitioning_column_name: str,
|
|
98
|
+
partition_type=bigquery.TimePartitioningType.DAY,
|
|
99
|
+
):
|
|
100
|
+
bq_table = self.check_table_exists(dataset_id, table_id)
|
|
101
|
+
if bq_table is None:
|
|
102
|
+
bq_table = self.create_partitioned_table(
|
|
103
|
+
dataset_id,
|
|
104
|
+
table_id,
|
|
105
|
+
schema_columns,
|
|
106
|
+
partitioning_column_name,
|
|
107
|
+
partition_type,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
self._insert_into_table(bq_table, records)
|
|
111
|
+
|
|
91
112
|
def delete_table(self, dataset_id: str, table_id: str) -> None:
|
|
92
113
|
if self.check_table_exists(dataset_id, table_id):
|
|
93
114
|
sql_format = self._get_table_id_sql_format(dataset_id, table_id)
|
|
@@ -99,6 +120,35 @@ class BigQuery:
|
|
|
99
120
|
except google.cloud.exceptions.NotFound:
|
|
100
121
|
return None
|
|
101
122
|
|
|
123
|
+
def create_partitioned_table(
|
|
124
|
+
self,
|
|
125
|
+
dataset_id: str,
|
|
126
|
+
table_id: str,
|
|
127
|
+
schema_columns: List[Dict],
|
|
128
|
+
partitioning_column_name: str,
|
|
129
|
+
partition_type=bigquery.TimePartitioningType.DAY,
|
|
130
|
+
):
|
|
131
|
+
table_schema = [
|
|
132
|
+
bigquery.schema.SchemaField(
|
|
133
|
+
row["name"],
|
|
134
|
+
row["col_type"],
|
|
135
|
+
mode=row["mode"],
|
|
136
|
+
fields=self.parse_fields(row["fields"]) if "fields" in row else [],
|
|
137
|
+
)
|
|
138
|
+
for row in schema_columns
|
|
139
|
+
]
|
|
140
|
+
try:
|
|
141
|
+
sql_format = self._get_table_id_sql_format(dataset_id, table_id)
|
|
142
|
+
table_object = bigquery.Table(sql_format, schema=table_schema)
|
|
143
|
+
# Set partitioning on the "report_date" column
|
|
144
|
+
table_object.time_partitioning = bigquery.TimePartitioning(
|
|
145
|
+
type_=partition_type,
|
|
146
|
+
field=partitioning_column_name, # The column to use for partitioning
|
|
147
|
+
)
|
|
148
|
+
return self._service.create_table(table_object)
|
|
149
|
+
except google.cloud.exceptions.Conflict:
|
|
150
|
+
return False
|
|
151
|
+
|
|
102
152
|
def create_table(
|
|
103
153
|
self, dataset_id: str, table_id: str, schema_columns: List[Dict]
|
|
104
154
|
) -> Union[bool, Table]:
|
{logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev14}/logos_sdk/services/MicrosoftAdvertising.py
RENAMED
|
@@ -17,6 +17,12 @@ class EntityStatus:
|
|
|
17
17
|
PAUSED = "Paused"
|
|
18
18
|
|
|
19
19
|
|
|
20
|
+
class BidMatchType:
|
|
21
|
+
EXACT = "Exact"
|
|
22
|
+
PHRASE = "Phrase"
|
|
23
|
+
BROAD = "Broad"
|
|
24
|
+
|
|
25
|
+
|
|
20
26
|
class MicrosoftAdvertising:
|
|
21
27
|
def __init__(self, url=None):
|
|
22
28
|
load_dotenv()
|
|
@@ -25,9 +31,14 @@ class MicrosoftAdvertising:
|
|
|
25
31
|
self._GET_ACCESSIBLE_ACCOUNTS = self._URL + "/accessible-accounts"
|
|
26
32
|
self._GET_ACCOUNT_ACCESSIBILITY = self._URL + "/get-account-accessibility"
|
|
27
33
|
self._GET_DESTINATION_URL_REPORT = self._URL + "/destination-url-report"
|
|
28
|
-
self._GET_CAMPAIGN_PERFORMANCE_REPORT =
|
|
29
|
-
|
|
34
|
+
self._GET_CAMPAIGN_PERFORMANCE_REPORT = (
|
|
35
|
+
self._URL + "/campaign-performance-report"
|
|
36
|
+
)
|
|
37
|
+
self._GET_GEOGRAPHIC_PERFORMANCE_REPORT = (
|
|
38
|
+
self._URL + "/geographic-performance-report"
|
|
39
|
+
)
|
|
30
40
|
self._GET_BUDGET_SUMMARY_REPORT = self._URL + "/budget-summary-report"
|
|
41
|
+
self._GET_SHARE_OF_VOICE_REPORT = self._URL + "/share-of-voice-report"
|
|
31
42
|
|
|
32
43
|
def get_destination_url_report(
|
|
33
44
|
self,
|
|
@@ -113,7 +124,69 @@ class MicrosoftAdvertising:
|
|
|
113
124
|
|
|
114
125
|
header = get_headers(self._GET_GEOGRAPHIC_PERFORMANCE_REPORT)
|
|
115
126
|
response = self.session.request(
|
|
116
|
-
"post",
|
|
127
|
+
"post",
|
|
128
|
+
url=self._GET_GEOGRAPHIC_PERFORMANCE_REPORT,
|
|
129
|
+
json=body,
|
|
130
|
+
headers=header,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
if response.status_code == HTTPStatus.OK:
|
|
134
|
+
service_response = response.json()
|
|
135
|
+
return service_response["data"]
|
|
136
|
+
else:
|
|
137
|
+
raise MicrosoftAdvertisingException(response.content)
|
|
138
|
+
|
|
139
|
+
def get_share_of_voice_report(
|
|
140
|
+
self,
|
|
141
|
+
account_id: str,
|
|
142
|
+
secret_id: str,
|
|
143
|
+
date_from: str,
|
|
144
|
+
date_to: str,
|
|
145
|
+
report_columns: List[str],
|
|
146
|
+
bid_match_type: str = None,
|
|
147
|
+
filter_keywords: List[str] = None,
|
|
148
|
+
entity_statuses: dict = None,
|
|
149
|
+
) -> List:
|
|
150
|
+
"""
|
|
151
|
+
Calls endpoint for getting share of voice stats
|
|
152
|
+
https://learn.microsoft.com/en-us/advertising/reporting-service/geographicperformancereportrequest?view=bingads-13&tabs=xml
|
|
153
|
+
:param account_id: The ID of the account in Microsoft Advertising
|
|
154
|
+
:param secret_id: The ID of the secret in secret manager
|
|
155
|
+
:param date_from: The date we want the report to start from. Must be before date to
|
|
156
|
+
:param date_to: The date we want the report to end at
|
|
157
|
+
:param report_columns: stats we want included in the report
|
|
158
|
+
:param bid_match_type: keywords with this bid match type will be returned
|
|
159
|
+
:param filter_keywords: just keywords from this list will be returned
|
|
160
|
+
:param entity_statuses: dict containing status ad_group_status, campaign_status, keyword_status and account_status
|
|
161
|
+
:return: List of share of voice stats
|
|
162
|
+
"""
|
|
163
|
+
if entity_statuses is None:
|
|
164
|
+
entity_statuses = {
|
|
165
|
+
"ad_group_status": EntityStatus.ACTIVE,
|
|
166
|
+
"campaign_status": EntityStatus.ACTIVE,
|
|
167
|
+
"account_status": EntityStatus.ACTIVE,
|
|
168
|
+
"keyword_status": EntityStatus.ACTIVE,
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
body = {
|
|
172
|
+
"account_id": account_id,
|
|
173
|
+
"secret_id": secret_id,
|
|
174
|
+
"date_from": date_from,
|
|
175
|
+
"date_to": date_to,
|
|
176
|
+
"report_columns": report_columns,
|
|
177
|
+
} | entity_statuses
|
|
178
|
+
|
|
179
|
+
if bid_match_type:
|
|
180
|
+
body["bid_match_type"] = bid_match_type
|
|
181
|
+
if filter_keywords:
|
|
182
|
+
body["filter_keywords"] = filter_keywords
|
|
183
|
+
|
|
184
|
+
header = get_headers(self._GET_SHARE_OF_VOICE_REPORT)
|
|
185
|
+
response = self.session.request(
|
|
186
|
+
"post",
|
|
187
|
+
url=self._GET_SHARE_OF_VOICE_REPORT,
|
|
188
|
+
json=body,
|
|
189
|
+
headers=header,
|
|
117
190
|
)
|
|
118
191
|
|
|
119
192
|
if response.status_code == HTTPStatus.OK:
|
|
@@ -173,7 +246,7 @@ class MicrosoftAdvertising:
|
|
|
173
246
|
secret_id: str,
|
|
174
247
|
date_from: str,
|
|
175
248
|
date_to: str,
|
|
176
|
-
report_columns: List[str]
|
|
249
|
+
report_columns: List[str],
|
|
177
250
|
):
|
|
178
251
|
"""
|
|
179
252
|
Calls endpoint for getting budget summary
|
|
@@ -211,12 +284,7 @@ class MicrosoftAdvertising:
|
|
|
211
284
|
:param secret_id: The ID of the secret in secret manager
|
|
212
285
|
:return: List of dicts with account_id and name keys
|
|
213
286
|
"""
|
|
214
|
-
body = {
|
|
215
|
-
"secret_id": secret_id,
|
|
216
|
-
"filters": {
|
|
217
|
-
"hide_inactive": True
|
|
218
|
-
}
|
|
219
|
-
}
|
|
287
|
+
body = {"secret_id": secret_id, "filters": {"hide_inactive": True}}
|
|
220
288
|
header = get_headers(self._GET_ACCESSIBLE_ACCOUNTS)
|
|
221
289
|
response = self.session.request(
|
|
222
290
|
"post", url=self._GET_ACCESSIBLE_ACCOUNTS, json=body, headers=header
|
|
@@ -235,10 +303,7 @@ class MicrosoftAdvertising:
|
|
|
235
303
|
:param account_id: The ID of the account in Microsoft Advertising
|
|
236
304
|
:return: True if account has access
|
|
237
305
|
"""
|
|
238
|
-
body = {
|
|
239
|
-
"secret_id": secret_id,
|
|
240
|
-
"account_id": account_id
|
|
241
|
-
}
|
|
306
|
+
body = {"secret_id": secret_id, "account_id": account_id}
|
|
242
307
|
header = get_headers(self._GET_ACCOUNT_ACCESSIBILITY)
|
|
243
308
|
response = self.session.request(
|
|
244
309
|
"post", url=self._GET_ACCOUNT_ACCESSIBILITY, json=body, headers=header
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: logos-sdk
|
|
3
|
-
Version: 0.0.25.
|
|
3
|
+
Version: 0.0.25.dev14
|
|
4
4
|
Summary: SDK for Logos platform
|
|
5
5
|
Home-page: https://bitbucket.org/databy/logos-sdk-pip/src/master/
|
|
6
6
|
Author: Databy.io
|
|
@@ -25,6 +25,7 @@ Dynamic: classifier
|
|
|
25
25
|
Dynamic: description
|
|
26
26
|
Dynamic: description-content-type
|
|
27
27
|
Dynamic: home-page
|
|
28
|
+
Dynamic: license-file
|
|
28
29
|
Dynamic: requires-dist
|
|
29
30
|
Dynamic: summary
|
|
30
31
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|