Ejemplo n.º 1
0
 def __init__(self, endpoint: str = "https://analytics-collection.adobe.io", config_object: dict = config.config_object):
     """
     Initialize the Bulk API connection. Returns an object with methods to send data to Analytics.
     Arguments:
         endpoint : REQUIRED : Endpoint to send data to. Default to analytics-collection.adobe.io
             possible values, on top of the default choice are:
                 - https://analytics-collection-va7.adobe.io	(US)
                 - https://analytics-collection-nld2.adobe.io (EU)
         config_object : REQUIRED : config object containing the different information to send data.
     """
     self.endpoint = endpoint
     try:
         import importlib.resources as pkg_resources
         path = pkg_resources.path(
             "aanalytics2", "CSV_Column_and_Query_String_Reference.pickle")
     except ImportError:
         # Try backported to PY<37 `importlib_resources`.
         import pkg_resources
         path = pkg_resources.resource_filename(
             "aanalytics2", "CSV_Column_and_Query_String_Reference.pickle")
     with path as f:
         self.REFERENCE = pd.read_pickle(f)
     # if no token has been generated.
     self.connector = connector.AdobeRequest()
     self.header = self.connector.header
     self.header["x-adobe-vgid"] = "ingestion"
     del self.header["Content-Type"]
     self._createdFiles = []
Ejemplo n.º 2
0
 def __init__(self, endpoint: str = "https://analytics-collection.adobe.io", config_object: dict = config.config_object):
     """
     Initialize the Bulk API connection. Returns an object with methods to send data to Analytics.
     Arguments:
         endpoint : REQUIRED : Endpoint to send data to. Default to analytics-collection.adobe.io
         config_object : REQUIRED : config object containing the different information to send data.
     """
     self.endpoint = endpoint
     try:
         import importlib.resources as pkg_resources
         path = pkg_resources.path(
             "aanalytics2", "CSV_Column_and_Query_String_Reference.pickle")
     except ImportError:
         # Try backported to PY<37 `importlib_resources`.
         import pkg_resources
         path = pkg_resources.resource_filename(
             "aanalytics2", "CSV_Column_and_Query_String_Reference.pickle")
     with path as f:
         self.REFERENCE = modules.pd.read_pickle(f)
     if config.api_key == "":
         raise Exception(
             "Import config file.\n Authentication is required for this endpoint.")
     # if no token has been generated.
     if len(config.header['Authorization']) < 100:
         token = aanalytics2.retrieveToken()
     self.connector = connector.AdobeRequest()
     self.header = self.connector.header
     self.header['"x-adobe-vgid"'] = "ingestion"
     self._createdFiles = []
 def __init__(self,
              company_name: str = None,
              config: dict = config.config_object) -> None:
     """
     Instancialize the Legacy Analytics wrapper.
     """
     if company_name is None:
         raise Exception("Require a company name")
     self.connector = connector.AdobeRequest(config_object=config)
     self.token = self.connector.token
     self.endpoint = "https://api.omniture.com/admin/1.4/rest"
     self.header = header = {
         'Accept': 'application/json',
         'Authorization': f'Bearer {self.token}',
         'X-ADOBE-DMA-COMPANY': company_name
     }