route1io_connectors.apple_search_ads module
Apple Search Ads
This module contains code for accessing data from Apple Search Ads.
References
- Apple Search Ads documentation
- Implementing OAuth for the Apple Search Ads API
- get_apple_data(access_token: str, org_id: int, start_date: datetime.datetime, end_date: datetime.datetime) pandas.core.frame.DataFrame
Return pd.DataFrame of Apple Search Ads data for a given organization between start and end dates (inclusive)
- Parameters
access_token (str) – Valid access token with permissions to access organization’s ad account https://developer.apple.com/documentation/apple_search_ads/implementing_oauth_for_the_apple_search_ads_api
org_id (int) – Organization whose ad account we are accessing data from
start_date (datetime.date) – Inclusive start date to pull data
end_date (datetime.date) – Inclusive end date to pull data
- Returns
full_df – DataFrame containing search ad data between start and end date for the organization
- Return type
pd.DataFrame
- refresh_access_token(client_id: str, client_secret: str) str
Returns a refreshed access token
- Parameters
client_id (str) – Valid client ID of the user requesting the data
client_secret (str) – Valid client secret token
- Returns
Credentials JSON with valid access token
- Return type
credentials_json
- refresh_client_secret(client_id: str, team_id: str, key_id: str, private_key: str) str
Return a refreshed client secret
- Parameters
client_id (str) – Valid client ID of the user requesting the data
team_id (str) – Valid team ID from Apple Search Ads platform
key_id (str) – Valid key ID from Apple Search Ads platform
- Returns
client_secret – Refreshed, valid client secret
- Return type
str
- request_access_token(client_id: str, client_secret: str) dict
Return JSON response after POST requesting an access token
- Parameters
client_id (str) – Valid client ID
client_secret (str) – Valid client secret
- Returns
POST request response with refreshed access token
- Return type
Response
- validate_client_secret(client_secret: str, client_id: str, team_id: str, key_id: str, private_key: str) str
Return client secret after being validated. If expired than create a new one
- Parameters
client_secret (str) – Client secret loaded from file
- Returns
client_secret – Client secret validated and refreshed if necessary
- Return type
str