diff --git a/src/factiva/analytics/auth/accountinfo.py b/src/factiva/analytics/auth/accountinfo.py index 063d85a..47a0a51 100755 --- a/src/factiva/analytics/auth/accountinfo.py +++ b/src/factiva/analytics/auth/accountinfo.py @@ -33,11 +33,11 @@ class AccountInfo: total_stream_instances: int = None total_stream_subscriptions: int = None enabled_company_identifiers: list = None - streams: StreamingInstanceList = None - extractions: SnapshotExtractionList = None + streams_list: StreamingInstanceList = None + extractions_list: SnapshotExtractionList = None - def __init__(self, user_key: UserKey or str=None): + def __init__(self, user_key: UserKey | str=None): """ Construct the instance of the class @@ -208,9 +208,9 @@ def get_extractions(self, updates=False) -> SnapshotExtractionList: if not updates: extraction_df = extraction_df.loc[extraction_df.update_id.isnull()] - self.extractions = SnapshotExtractionList(extraction_df) + self.extractions_list = SnapshotExtractionList(extraction_df) self.__log.info('get_extractions ended') - return self.extractions + return self.extractions_list @log.factiva_logger() @@ -269,7 +269,7 @@ def extract_subscriptions(subscription): else: raise RuntimeError('Unexpected Get Streams API Error') - self.streams = StreamingInstanceList(stream_df) + self.streams_list = StreamingInstanceList(stream_df) self.__log.info('get_streams ended') return stream_df diff --git a/src/factiva/analytics/auth/userkey.py b/src/factiva/analytics/auth/userkey.py index b2d910d..01e3444 100755 --- a/src/factiva/analytics/auth/userkey.py +++ b/src/factiva/analytics/auth/userkey.py @@ -4,7 +4,7 @@ Factiva Analytics APIs. """ import json -import pandas as pd +# import pandas as pd from ..common import log, req, tools, const, config @@ -16,7 +16,7 @@ class UserKey: """ # __API_ENDPOINT_BASEURL = f'{const.API_HOST}{const.API_ACCOUNT_BASEPATH}/' - __API_CLOUD_TOKEN_URL = f'{const.API_HOST}{const.ALPHA_BASEPATH}{const.API_ACCOUNT_STREAM_CREDENTIALS_BASEPATH}' + __API_CLOUD_TOKEN_URL = f'{const.API_HOST}{const.API_ACCOUNT_STREAM_CREDENTIALS_BASEPATH}' __log = None key: str = None diff --git a/src/factiva/analytics/common/const.py b/src/factiva/analytics/common/const.py index 8945acd..5134f97 100644 --- a/src/factiva/analytics/common/const.py +++ b/src/factiva/analytics/common/const.py @@ -9,18 +9,18 @@ API_LATEST_VERSION = "2.0" # UserKey -API_ACCOUNT_BASEPATH = '/alpha/accounts' -API_ACCOUNT_STREAM_CREDENTIALS_BASEPATH = '/accounts/streaming-credentials' +API_ACCOUNT_BASEPATH = '/sns-accounts' +API_ACCOUNT_STREAM_CREDENTIALS_BASEPATH = '/sns-accounts/streaming-credentials' # Dynamic Prefixes -ALPHA_BASEPATH = '/alpha' +# ALPHA_BASEPATH = '' DNA_BASEPATH = '/dna' # Deprecated # Snapshots -API_SNAPSHOTS_BASEPATH = '/alpha/extractions/documents' +API_SNAPSHOTS_BASEPATH = '/extractions/documents' API_EXPLAIN_SUFFIX = '/_explain' API_ANALYTICS_BASEPATH = '/alpha/analytics' -API_EXTRACTIONS_BASEPATH = '/alpha/extractions' +API_EXTRACTIONS_BASEPATH = '/extractions' API_EXTRACTIONS_SAMPLES_SUFFIX = '/samples' API_DEFAULT_EXTRACTION_TYPE = "documents" API_SAMPLES_EXTRACTION_TYPE = "samples" diff --git a/src/factiva/analytics/common/tools.py b/src/factiva/analytics/common/tools.py index 16404e0..44ef1a6 100644 --- a/src/factiva/analytics/common/tools.py +++ b/src/factiva/analytics/common/tools.py @@ -14,7 +14,10 @@ def print_property(property_value, default='') -> str: elif isinstance(property_value, float): pval = f'{property_value:,f}' elif isinstance(property_value, list): - pval = f' - [{len(property_value)}] elements' + if(type(property_value) == list): + pval = f' - [{len(property_value)}] elements' + else: + pval = f' - [{len(property_value.items)}] elements' elif isinstance(property_value, pd.DataFrame): pval = f" - [{property_value.shape[0]}] rows" else: