logos-sdk 0.0.25.dev6__tar.gz → 0.0.25.dev8__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.dev6 → logos_sdk-0.0.25.dev8}/PKG-INFO +1 -1
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/services/Collabim.py +2 -1
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/services/MarketMiner.py +4 -2
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/services/MicrosoftAdvertising.py +47 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/services/Sklik.py +16 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk.egg-info/PKG-INFO +1 -1
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/LICENSE +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/README.md +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/__init__.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/big_query/BigQuery.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/big_query/__init__.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/logging/LogosLogger.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/logging/__init__.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/services/CampaignManager.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/services/DV360.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/services/Facebook.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/services/GoogleAds.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/services/GoogleSheets.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/services/MerchantCenter.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk/services/__init__.py +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk.egg-info/SOURCES.txt +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk.egg-info/dependency_links.txt +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk.egg-info/requires.txt +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/logos_sdk.egg-info/top_level.txt +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/setup.cfg +0 -0
- {logos_sdk-0.0.25.dev6 → logos_sdk-0.0.25.dev8}/setup.py +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from requests import request
|
|
1
|
+
"""from requests import request
|
|
2
2
|
from typing import List, Dict
|
|
3
3
|
from logos_sdk.services import get_headers
|
|
4
4
|
from http import HTTPStatus
|
|
@@ -208,3 +208,4 @@ class CollabimService:
|
|
|
208
208
|
return service_response["data"]
|
|
209
209
|
|
|
210
210
|
raise CollabimServiceException(service_response)
|
|
211
|
+
"""
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"""
|
|
1
2
|
from requests import request
|
|
2
3
|
from typing import List
|
|
3
4
|
from logos_sdk.services import get_headers
|
|
@@ -18,12 +19,12 @@ class MarketMiner:
|
|
|
18
19
|
self._SEARCH_VOLUME = self._URL + "/search-volume-data"
|
|
19
20
|
|
|
20
21
|
def search_volume_data(self, lang: str, keywords: List[str]) -> List:
|
|
21
|
-
|
|
22
|
+
|
|
22
23
|
Function to call mm api point
|
|
23
24
|
:param lang: Language can be "cs", "sk", "us", "pl", "gb"
|
|
24
25
|
:param keywords: List of keywords you want search volume
|
|
25
26
|
:return:
|
|
26
|
-
|
|
27
|
+
|
|
27
28
|
body = {
|
|
28
29
|
"lang": lang,
|
|
29
30
|
"keywords": keywords
|
|
@@ -37,3 +38,4 @@ class MarketMiner:
|
|
|
37
38
|
return service_response["data"]
|
|
38
39
|
|
|
39
40
|
raise MarketMinerServiceException(service_response)
|
|
41
|
+
"""
|
|
@@ -25,6 +25,7 @@ class MicrosoftAdvertising:
|
|
|
25
25
|
self._GET_ACCESSIBLE_ACCOUNTS = self._URL + "/accessible-accounts"
|
|
26
26
|
self._GET_DESTINATION_URL_REPORT = self._URL + "/destination-url-report"
|
|
27
27
|
self._GET_CAMPAIGN_PERFORMANCE_REPORT = self._URL + "/campaign-performance-report"
|
|
28
|
+
self._GET_GEOGRAPHIC_PERFORMANCE_REPORT = self._URL + "/geographic-performance-report"
|
|
28
29
|
self._GET_BUDGET_SUMMARY_REPORT = self._URL + "/budget-summary-report"
|
|
29
30
|
|
|
30
31
|
def get_destination_url_report(
|
|
@@ -74,6 +75,52 @@ class MicrosoftAdvertising:
|
|
|
74
75
|
else:
|
|
75
76
|
raise MicrosoftAdvertisingException(response.content)
|
|
76
77
|
|
|
78
|
+
def get_geographic_report(
|
|
79
|
+
self,
|
|
80
|
+
account_id: str,
|
|
81
|
+
secret_id: str,
|
|
82
|
+
date_from: str,
|
|
83
|
+
date_to: str,
|
|
84
|
+
report_columns: List[str],
|
|
85
|
+
entity_statuses: dict = None,
|
|
86
|
+
) -> List:
|
|
87
|
+
"""
|
|
88
|
+
Calls endpoint for getting geographic stats
|
|
89
|
+
https://learn.microsoft.com/en-us/advertising/reporting-service/geographicperformancereportrequest?view=bingads-13&tabs=xml
|
|
90
|
+
:param account_id: The ID of the account in Microsoft Advertising
|
|
91
|
+
:param secret_id: The ID of the secret in secret manager
|
|
92
|
+
:param date_from: The date we want the report to start from. Must be before date to
|
|
93
|
+
:param date_to: The date we want the report to end at
|
|
94
|
+
:param report_columns: stats we want included in the report
|
|
95
|
+
:param entity_statuses: dict containing status ad_group_status, campaign_status and account_status
|
|
96
|
+
:return: List of campaigns and their geographic stats
|
|
97
|
+
"""
|
|
98
|
+
if entity_statuses is None:
|
|
99
|
+
entity_statuses = {
|
|
100
|
+
"ad_group_status": EntityStatus.ACTIVE,
|
|
101
|
+
"campaign_status": EntityStatus.ACTIVE,
|
|
102
|
+
"account_status": EntityStatus.ACTIVE,
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
body = {
|
|
106
|
+
"account_id": account_id,
|
|
107
|
+
"secret_id": secret_id,
|
|
108
|
+
"date_from": date_from,
|
|
109
|
+
"date_to": date_to,
|
|
110
|
+
"report_columns": report_columns,
|
|
111
|
+
} | entity_statuses
|
|
112
|
+
|
|
113
|
+
header = get_headers(self._GET_GEOGRAPHIC_PERFORMANCE_REPORT)
|
|
114
|
+
response = request(
|
|
115
|
+
"post", url=self._GET_GEOGRAPHIC_PERFORMANCE_REPORT, json=body, headers=header
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
if response.status_code == HTTPStatus.OK:
|
|
119
|
+
service_response = response.json()
|
|
120
|
+
return service_response["data"]
|
|
121
|
+
else:
|
|
122
|
+
raise MicrosoftAdvertisingException(response.content)
|
|
123
|
+
|
|
77
124
|
def get_campaign_performance_report(
|
|
78
125
|
self,
|
|
79
126
|
account_id: str,
|
|
@@ -46,6 +46,21 @@ def get_session_if_malformed(wrapped_function):
|
|
|
46
46
|
|
|
47
47
|
return inner
|
|
48
48
|
|
|
49
|
+
def get_report_results_if_expired(wrapped_function):
|
|
50
|
+
@wraps(wrapped_function)
|
|
51
|
+
def inner(*args, **kwargs):
|
|
52
|
+
try:
|
|
53
|
+
return wrapped_function(*args, **kwargs)
|
|
54
|
+
except SklikServiceException as err:
|
|
55
|
+
if json.loads(err.args[0].decode("utf8")).get("detail") == "Requested report has expired. Please create a new report by calling createReport endpoint.":
|
|
56
|
+
print("Report expired, creating new report")
|
|
57
|
+
args[0].get_session(args[0]._secret_id, args[0]._account_email)
|
|
58
|
+
return wrapped_function(*args, **kwargs)
|
|
59
|
+
else:
|
|
60
|
+
raise err
|
|
61
|
+
|
|
62
|
+
return inner
|
|
63
|
+
|
|
49
64
|
|
|
50
65
|
class SklikService:
|
|
51
66
|
def __init__(self, url=None):
|
|
@@ -95,6 +110,7 @@ class SklikService:
|
|
|
95
110
|
pass
|
|
96
111
|
|
|
97
112
|
@get_session_if_malformed
|
|
113
|
+
@get_report_results_if_expired
|
|
98
114
|
def get_report_results(
|
|
99
115
|
self,
|
|
100
116
|
secret_id: str,
|
|
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
|