class AdobeAnalytics20ReaderConfig(BaseModel): client_id: str client_secret: str tech_account_id: str org_id: str private_key: str global_company_id: str report_suite_id: str dimension: List[str] metric: List[str] start_date: datetime = None end_date: datetime = None date_range: Literal[tuple(DEFAULT_DATE_RANGE_FUNCTIONS.keys())] = None @validator("start_date", "end_date", pre=True) def date_format(cls, v): if isinstance(v, str): try: return datetime.strptime(v, "%Y-%m-%d") except ValueError: raise ValueError("Datetime format must follow 'YYYY-MM-DD'") return v @validator("private_key") def format_key_if_needed(cls, v): """ From the old Click behavior. In case if needed. In some cases, newlines are escaped when passed as a click.option(). This callback corrects this unexpected behaviour. """ return v.replace("\\n", "\n")
class TwitterReaderConfig(BaseModel): consumer_key: str consumer_secret: str access_token: str access_token_secret: str account_id: str report_type: Literal[tuple(REPORT_TYPES)] entity: Literal[tuple(ENTITY_ATTRIBUTES.keys())] entity_attribute: List[str] = [] granularity: Literal[tuple(GRANULARITIES)] = "TOTAL" metric_group: List[Literal[tuple(METRIC_GROUPS)]] = [] placement: Literal[tuple(PLACEMENTS)] = "ALL_ON_TWITTER" segmentation_type: Literal[tuple(SEGMENTATION_TYPES)] = None platform: str = None country: str = None start_date: datetime = None end_date: datetime = None add_request_date_to_report: bool = False date_range: Literal[tuple(DEFAULT_DATE_RANGE_FUNCTIONS.keys())] = None @validator("start_date", "end_date", pre=True) def date_format(cls, v): if isinstance(v, str): try: return datetime.strptime(v, "%Y-%m-%d") except ValueError: raise ValueError("Datetime format must follow 'YYYY-MM-DD'") return v
class MyTargetReaderConfig(BaseModel): client_id: str client_secret: str refresh_token: str request_type: Literal[tuple(REQUEST_TYPES)] date_range: Literal[tuple(DEFAULT_DATE_RANGE_FUNCTIONS.keys())] = None start_date: datetime = None end_date: datetime = None @validator("start_date", "end_date", pre=True) def date_format(cls, v): if isinstance(v, str): try: return datetime.strptime(v, "%Y-%m-%d") except ValueError: raise ValueError("Datetime format must follow 'YYYY-MM-DD'") return v
class TheTradeDeskReaderConfig(BaseModel): login: str password: str advertiser_id: List[str] report_template_name: str report_schedule_name: str start_date: datetime = None end_date: datetime = None date_range: Literal[tuple(DEFAULT_DATE_RANGE_FUNCTIONS.keys())] = None @validator("start_date", "end_date", pre=True) def date_format(cls, v): if isinstance(v, str): try: return datetime.strptime(v, "%Y-%m-%d") except ValueError: raise ValueError("Datetime format must follow 'YYYY-MM-DD'") return v
class GoogleSearchConsoleReaderConfig(BaseModel): client_id: str client_secret: str access_token: str = "" refresh_token: str dimensions: List[str] site_url: str start_date: datetime = None end_date: datetime = None date_column: bool = False row_limit: int = 25000 date_range: Literal[tuple(DEFAULT_DATE_RANGE_FUNCTIONS.keys())] = None @validator("start_date", "end_date", pre=True) def date_format(cls, v): if isinstance(v, str): try: return datetime.strptime(v, "%Y-%m-%d") except ValueError: raise ValueError("Datetime format must follow 'YYYY-MM-DD'") return v
class GoogleDCMReaderConfig(BaseModel): access_token: str = None client_id: str client_secret: str refresh_token: str profile_ids: List[str] report_name: str = "DCM Report" report_type: Literal[tuple(REPORT_TYPES)] = REPORT_TYPES[0] metrics: List[str] = [] dimensions: List[str] = [] start_date: datetime = None end_date: datetime = None filters: List[Tuple[str, str]] = [] date_range: Literal[tuple(DEFAULT_DATE_RANGE_FUNCTIONS.keys())] = None @validator("start_date", "end_date", pre=True) def date_format(cls, v): if isinstance(v, str): try: return datetime.strptime(v, "%Y-%m-%d") except ValueError: raise ValueError("Datetime format must follow 'YYYY-MM-DD'") return v
class GoogleSA360ReaderConfig(BaseModel): access_token: str = None refresh_token: str client_id: str client_secret: str agency_id: str advertiser_ids: List[str] = [] report_name: str = "SA360 Report" report_type: Literal[tuple(REPORT_TYPES)] = REPORT_TYPES[0] columns: List[str] = [] saved_columns: List[str] = [] start_date: datetime = None end_date: datetime = None date_range: Literal[tuple(DEFAULT_DATE_RANGE_FUNCTIONS.keys())] = None @validator("start_date", "end_date", pre=True) def date_format(cls, v): if isinstance(v, str): try: return datetime.strptime(v, "%Y-%m-%d") except ValueError: raise ValueError("Datetime format must follow 'YYYY-MM-DD'") return v
"--ttd-report-template-name", required=True, help= "Exact name of the Report Template to request. Existing Report Templates " "can be found within the MyReports section of The Trade Desk UI.", ) @click.option( "--ttd-report-schedule-name", required=True, help="Name of the Report Schedule to create.", ) @click.option( "--ttd-start-date", type=click.DateTime(), help="Start date of the period to request (format: YYYY-MM-DD)", ) @click.option( "--ttd-end-date", type=click.DateTime(), help="End date of the period to request (format: YYYY-MM-DD)", ) @click.option( "--ttd-date-range", type=click.Choice(DEFAULT_DATE_RANGE_FUNCTIONS.keys()), help= f"One of the available ACK default date ranges: {DEFAULT_DATE_RANGE_FUNCTIONS.keys()}", ) @processor("ttd_login", "ttd_password") def the_trade_desk(**kwargs): return TheTradeDeskReader(**extract_args("ttd_", kwargs))