Package: fds.sdk.DocumentsDistributorDocuments
Documents Distributor - Documents client library for PythonDocuments APIs that provide filings such as Global Filings and XML files such as StreetAccountGlobal Filings API provides the capability to search and download filings documents from various exchanges around the world. This API will provide access to the full history and the ability to search by date and dataset(source). It does not provide real-time updates to the filings documents. Filings providers currently include EDGARNote: The real-time updates to the filing documents will be available within week to ten days and per request able to query up to 8 days of dataStreetAccount XML API provides access to historical StreetAccount (SA) news. SA provides a summary for various corporate and market news written by journalist with background in financial markets.The API delivers SA stories in XML format based on user-specified date input parameters. When the API request is completed, output files will be made available back to the users through a secure URL. This API has three endpoints (1) Request Files (2) Check Status (3) Get Files.This API only supports adhoc requests to retrieve historical files and does not support real-time files and if require real-time push should consider the other three methods (pushed via SFTP, to QNT account, or users Azure Storage)Both historical and real-time Street Account news is also delivered via SFTP, to users QNT account, or users Azure Storage.Files delivered contain both metadata and content body in each file. This eliminates the need to make multiple requests through multiple services to get all the information.News API provides access to historical news. This provides a summary for various corporate and market news written by journalist with background in financial markets.The API delivers  stories in different format based on user-specified date input parameters. When the API request is completed, output files will be made available back to the users through a secure URL. This API has three endpoints (1) Request Files (2) Check Status (3) Get FilesThis Python package is automatically generated by theOpenAPI Generatorproject:API version: 1.0.0Package version: 0.21.9Build package: org.openapitools.codegen.languages.PythonClientCodegenRequirementsPython >= 3.7InstallationPoetrypoetryaddfds.sdk.utilsfds.sdk.DocumentsDistributorDocuments==0.21.9pippipinstallfds.sdk.utilsfds.sdk.DocumentsDistributorDocuments==0.21.9UsageGenerate authentication credentials.Setup Python environment.Install and activate python 3.7+. If you're usingpyenv:pyenvinstall3.9.7
pyenvshell3.9.7(optional)Install poetry.Install dependencies.Run the following:fromfds.sdk.utils.authenticationimportConfidentialClientimportfds.sdk.DocumentsDistributorDocumentsfromfds.sdk.DocumentsDistributorDocuments.apiimportglobal_filings_api_apifromfds.sdk.DocumentsDistributorDocuments.modelsimport*fromdateutil.parserimportparseasdateutil_parserfrompprintimportpprint# See configuration.py for a list of all supported configuration parameters.# Examples for each supported authentication method are below,# choose one that satisfies your use case.# (Preferred) OAuth 2.0: FactSetOAuth2# See https://github.com/FactSet/enterprise-sdk#oauth-20# for information on how to create the app-config.json file## The confidential client instance should be reused in production environments.# See https://github.com/FactSet/enterprise-sdk-utils-python#authentication# for more information on using the ConfidentialClient classconfiguration=fds.sdk.DocumentsDistributorDocuments.Configuration(fds_oauth_client=ConfidentialClient('/path/to/app-config.json'))# Basic authentication: FactSetApiKey# See https://github.com/FactSet/enterprise-sdk#api-key# for information how to create an API key# configuration = fds.sdk.DocumentsDistributorDocuments.Configuration(#     username='USERNAME-SERIAL',#     password='API-KEY'# )# Enter a context with an instance of the API clientwithfds.sdk.DocumentsDistributorDocuments.ApiClient(configuration)asapi_client:# Create an instance of the API classapi_instance=global_filings_api_api.GlobalFilingsAPIApi(api_client)# NOTE: The parameter variable defined below is just an example and may potentially contain non valid values. So please replace this with valid values.start_date=dateutil_parser('1970-01-01').date()# date | The earliest date the API should fetch for. Dates can be YYYY-MM-DD format# NOTE: The parameter variable defined below is just an example and may potentially contain non valid values. So please replace this with valid values.end_date=dateutil_parser('1970-01-01').date()# date | The date after upto eight days of the earliest date given the API should fetch for. Dates can be YYYY-MM-DD formattry:# Retrieve filings within FactSet coverage# example passing only required values which don't have defaults setapi_response=api_instance.global_filings_v1_list_files_get(start_date,end_date)pprint(api_response)exceptfds.sdk.DocumentsDistributorDocuments.ApiExceptionase:print("Exception when calling GlobalFilingsAPIApi->global_filings_v1_list_files_get:%s\n"%e)# # Get response, http status code and response headers# try:#     # Retrieve filings within FactSet coverage#     api_response, http_status_code, response_headers = api_instance.global_filings_v1_list_files_get_with_http_info(start_date, end_date)#     pprint(api_response)#     pprint(http_status_code)#     pprint(response_headers)# except fds.sdk.DocumentsDistributorDocuments.ApiException as e:#     print("Exception when calling GlobalFilingsAPIApi->global_filings_v1_list_files_get: %s\n" % e)# # Get response asynchronous# try:#     # Retrieve filings within FactSet coverage#     async_result = api_instance.global_filings_v1_list_files_get_async(start_date, end_date)#     api_response = async_result.get()#     pprint(api_response)# except fds.sdk.DocumentsDistributorDocuments.ApiException as e:#     print("Exception when calling GlobalFilingsAPIApi->global_filings_v1_list_files_get: %s\n" % e)# # Get response, http status code and response headers asynchronous# try:#     # Retrieve filings within FactSet coverage#     async_result = api_instance.global_filings_v1_list_files_get_with_http_info_async(start_date, end_date)#     api_response, http_status_code, response_headers = async_result.get()#     pprint(api_response)#     pprint(http_status_code)#     pprint(response_headers)# except fds.sdk.DocumentsDistributorDocuments.ApiException as e:#     print("Exception when calling GlobalFilingsAPIApi->global_filings_v1_list_files_get: %s\n" % e)Using PandasTo convert an API response to a Pandas DataFrame, it is necessary to transform it first to a dictionary.importpandasaspdresponse_dict=api_response.to_dict()['data']simple_json_response=pd.DataFrame(response_dict)nested_json_response=pd.json_normalize(response_dict)DebuggingThe SDK uses the standard libraryloggingmodule.SettingdebugtoTrueon an instance of theConfigurationclass sets the log-level of related packages toDEBUGand enables additional logging in PythonsHTTP Client.Note: This prints out sensitive information (e.g. the full request and response). Use with care.importloggingimportfds.sdk.DocumentsDistributorDocumentslogging.basicConfig(level=logging.DEBUG)configuration=fds.sdk.DocumentsDistributorDocuments.Configuration(...)configuration.debug=TrueConfigure a ProxyYou can pass proxy settings to the Configuration class:proxy: The URL of the proxy to use.proxy_headers: a dictionary to pass additional headers to the proxy (e.g.Proxy-Authorization).importfds.sdk.DocumentsDistributorDocumentsconfiguration=fds.sdk.DocumentsDistributorDocuments.Configuration(# ...proxy="http://secret:password@localhost:5050",proxy_headers={"Custom-Proxy-Header":"Custom-Proxy-Header-Value"})Custom SSL CertificateTLS/SSL certificate verification can be configured with the following Configuration parameters:ssl_ca_cert: a path to the certificate to use for verification inPEMformat.verify_ssl: setting this toFalsedisables the verification of certificates.
Disabling the verification is not recommended, but it might be useful during
local development or testing.importfds.sdk.DocumentsDistributorDocumentsconfiguration=fds.sdk.DocumentsDistributorDocuments.Configuration(# ...ssl_ca_cert='/path/to/ca.pem')Documentation for API EndpointsAll URIs are relative tohttps://api.factset.com/bulk-documentsClassMethodHTTP requestDescriptionGlobalFilingsAPIApiglobal_filings_v1_list_files_getGET/global-filings/v1/list-filesRetrieve filings within FactSet coverageNewsAPIApiasynch_news_v1_check_status_getGET/asynch/news/v1/check-statusReturns the status and percentDone of the requested jobID and sourceNewsAPIApiasynch_news_v1_get_files_getGET/asynch/news/v1/get-filesReturns the news filings for the specified daterange and sourceNewsAPIApiasynch_news_v1_request_files_getGET/asynch/news/v1/request-filesReturns the jobIDStreetAccountXMLAPIApiasynch_streetaccount_v1_check_status_getGET/asynch/streetaccount/v1/check-statusReturns the status and percentDone of the requested jobIDStreetAccountXMLAPIApiasynch_streetaccount_v1_get_files_getGET/asynch/streetaccount/v1/get-filesReturns the SA XML files for the specified daterangeStreetAccountXMLAPIApiasynch_streetaccount_v1_request_files_getGET/asynch/streetaccount/v1/request-filesReturns the jobIDDocumentation For ModelsCheckstatusCheckstatusResponseCheckstatusoneFilingsFilesFilingsResponseGetfilesGetfilesResponseGetfilesoneIsPartialOneMetaOneNewsStatusNewscheckstatusResponseNewsgetfilesResponseNewsrequestfilesResponsePaginationOneRequestfilesResponseStatusStreetAccountStatusDocumentation For AuthorizationFactSetApiKeyType: HTTP basic authenticationFactSetOAuth2Type: OAuthFlow: applicationAuthorization URL:Scopes: N/ANotes for Large OpenAPI documentsIf the OpenAPI document is large, imports in fds.sdk.DocumentsDistributorDocuments.apis and fds.sdk.DocumentsDistributorDocuments.models may fail with a
RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:Solution 1:
Use specific imports for apis and models like:from fds.sdk.DocumentsDistributorDocuments.api.default_api import DefaultApifrom fds.sdk.DocumentsDistributorDocuments.model.pet import PetSolution 2:
Before importing the package, adjust the maximum recursion limit as shown below:import sys
sys.setrecursionlimit(1500)
import fds.sdk.DocumentsDistributorDocuments
from fds.sdk.DocumentsDistributorDocuments.apis import *
from fds.sdk.DocumentsDistributorDocuments.models import *ContributingPlease refer to thecontributing guide.CopyrightCopyright 2022 FactSet Research Systems IncLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.