logos-sdk 0.0.25.dev12__tar.gz → 0.0.25.dev13__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.
Files changed (26) hide show
  1. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/PKG-INFO +1 -1
  2. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/services/MicrosoftAdvertising.py +79 -14
  3. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk.egg-info/PKG-INFO +1 -1
  4. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/LICENSE +0 -0
  5. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/README.md +0 -0
  6. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/__init__.py +0 -0
  7. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/big_query/BigQuery.py +0 -0
  8. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/big_query/__init__.py +0 -0
  9. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/logging/LogosLogger.py +0 -0
  10. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/logging/__init__.py +0 -0
  11. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/services/CampaignManager.py +0 -0
  12. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/services/Collabim.py +0 -0
  13. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/services/DV360.py +0 -0
  14. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/services/Facebook.py +0 -0
  15. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/services/GoogleAds.py +0 -0
  16. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/services/GoogleSheets.py +0 -0
  17. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/services/MarketMiner.py +0 -0
  18. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/services/MerchantCenter.py +0 -0
  19. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/services/Sklik.py +0 -0
  20. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk/services/__init__.py +0 -0
  21. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk.egg-info/SOURCES.txt +0 -0
  22. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk.egg-info/dependency_links.txt +0 -0
  23. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk.egg-info/requires.txt +0 -0
  24. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/logos_sdk.egg-info/top_level.txt +0 -0
  25. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/setup.cfg +0 -0
  26. {logos_sdk-0.0.25.dev12 → logos_sdk-0.0.25.dev13}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: logos-sdk
3
- Version: 0.0.25.dev12
3
+ Version: 0.0.25.dev13
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
@@ -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 = self._URL + "/campaign-performance-report"
29
- self._GET_GEOGRAPHIC_PERFORMANCE_REPORT = self._URL + "/geographic-performance-report"
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", url=self._GET_GEOGRAPHIC_PERFORMANCE_REPORT, json=body, headers=header
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
1
  Metadata-Version: 2.2
2
2
  Name: logos-sdk
3
- Version: 0.0.25.dev12
3
+ Version: 0.0.25.dev13
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