diff --git a/src/factiva/analytics/snapshots/time_series.py b/src/factiva/analytics/snapshots/time_series.py index f357080..6cecf38 100644 --- a/src/factiva/analytics/snapshots/time_series.py +++ b/src/factiva/analytics/snapshots/time_series.py @@ -28,6 +28,7 @@ class SnapshotTimeSeriesJobReponse(SnapshotBaseJobResponse): """ data : pd.DataFrame = None + download_link : str = None errors : list[dict] = None # Consider adding calculated values for start/end date and the number # of records @@ -43,7 +44,7 @@ def __repr__(self): def __str__(self, detailed=True, prefix=' ├─', root_prefix=''): ret_val = super().__str__(detailed, prefix, root_prefix) - ret_val += f"{prefix}data: {tools.print_property(self.data)}" + ret_val += f"{prefix}download_link: {tools.print_property(self.download_link)}" if self.errors: ret_val += f"\n{prefix.replace('├', '└')}errors: [{len(self.errors)}]" err_list = [f"\n{prefix[0:-1]} |-{err['title']}: {err['detail']}" for err in self.errors] @@ -284,8 +285,7 @@ def submit_job(self): headers_dict = { 'user-key': self.user_key.key, - 'Content-Type': 'application/json', - 'X-API-VERSION': '2.0' + 'Content-Type': 'application/json' } submit_url = f'{self.__JOB_BASE_URL}' @@ -341,7 +341,8 @@ def get_job_response(self) -> bool: self.job_response.job_state = response_data['data']['attributes']['current_state'] self.job_response.job_link = response_data['links']['self'] if self.job_response.job_state == const.API_JOB_DONE_STATE: - self.job_response.data = pd.DataFrame(response_data['data']['attributes']['results']) + # self.job_response.data = pd.DataFrame(response_data['data']['attributes']['results']) + self.job_response.download_link = response_data['data']['attributes']['download_link'] if 'errors' in response_data.keys(): self.job_response.errors = response_data['errors'] elif response.status_code == 404: diff --git a/test/snapshots/test_timeseries.py b/test/snapshots/test_timeseries.py index 66e9c23..8460c9e 100644 --- a/test/snapshots/test_timeseries.py +++ b/test/snapshots/test_timeseries.py @@ -118,6 +118,6 @@ def test_job_envuser_envwhere(): assert len(sts.job_response.job_id) == 36 assert sts.job_response.job_link.startswith(const.API_HOST) assert (sts.job_response.errors == None) - assert isinstance(sts.job_response.data, pd.DataFrame) - assert len(sts.job_response.data.columns) >= 2 + # assert isinstance(sts.job_response.data, pd.DataFrame) + # assert len(sts.job_response.data.columns) >= 2