Skip to content

Commit

Permalink
Alphaless for accinfo and multiple fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
miballe committed Aug 28, 2024
1 parent 8c6b8ff commit e602f7b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/factiva/analytics/auth/accountinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/factiva/analytics/auth/userkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/factiva/analytics/common/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion src/factiva/analytics/common/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ def print_property(property_value, default='<NotSet>') -> str:
elif isinstance(property_value, float):
pval = f'{property_value:,f}'
elif isinstance(property_value, list):
pval = f'<list> - [{len(property_value)}] elements'
if(type(property_value) == list):
pval = f'<list> - [{len(property_value)}] elements'
else:
pval = f'<list> - [{len(property_value.items)}] elements'
elif isinstance(property_value, pd.DataFrame):
pval = f"<pandas.DataFrame> - [{property_value.shape[0]}] rows"
else:
Expand Down

0 comments on commit e602f7b

Please sign in to comment.