This project is an extractor for the SAP Ariba API. It allows you to extract data from the SAP Ariba platform and save it to a local file in CSV format.
The extractor uses the httpx
library to make HTTP requests to the SAP Ariba API and handle the authentication. The data is then parsed and written to a CSV file using the csv
library.
The extractor is easy to use and customizable, you can configure the extractor to extract data from different parts of the SAP Ariba API by modifying the endpoints and the parameters of the requests.
The extractor also includes a built-in rate limiter to ensure that the requests are sent at a safe rate and avoid overwhelming the API.
The project also includes a requirements.txt file for you to install the necessary dependencies.
To use the extractor, you will need to have an SAP Ariba API key, which can be obtained from the Ariba developer portal.
The extractor is built in Python, it is compatible with Python 3.10
.
This extractor can be useful for businesses that use SAP Ariba to manage their procurement processes, allowing them to extract and analyze data to make better decisions, automate processes, and integrate the data with other systems.
pip install -r requirements.txt
To use the tool, you need to provide a YAML configuration file that specifies the constants needed to work. Here's an example:
constants:
p2p_realm: &p2p_realm '****'
sourcing_realm: &sourcing_realm '****'
stage: &stage '****'
base_url: &base_url '****'
oauth_url: &oauth_url '****'
# Procurement
operational_reporting_for_procurement_api_key: &operational_reporting_for_procurement_api_key '****'
operational_reporting_for_procurement_client_id: &operational_reporting_for_procurement_client_id '****'
operational_reporting_for_procurement_secret: &operational_reporting_for_procurement_secret '****'
document_approval_api_key: &document_approval_api_key '****'
document_approval_client_id: &document_approval_client_id '****'
document_approval_secret: &document_approval_secret '****'
master_data_for_procurement_api_key: &master_data_for_procurement_api_key '****'
master_data_for_procurement_client_id: &master_data_for_procurement_client_id '****'
master_data_for_procurement_secret: &master_data_for_procurement_secret '****'
supplier_data_with_pagination_api_key: &supplier_data_with_pagination_api_key '****'
supplier_data_with_pagination_client_id: &supplier_data_with_pagination_client_id '****'
supplier_data_with_pagination_secret: &supplier_data_with_pagination_secret '****'
# Sourcing
operational_reporting_for_sourcing_api_key: &operational_reporting_for_sourcing_api_key '****'
operational_reporting_for_sourcing_client_id: &operational_reporting_for_sourcing_client_id '****'
operational_reporting_for_sourcing_secret: &operational_reporting_for_sourcing_secret '****'
sourcing_project_managment_api_key: &sourcing_project_managment_api_key '****'
sourcing_project_managment_client_id: &sourcing_project_managment_client_id '****'
sourcing_project_managment_secret: &sourcing_project_managment_secret '****'
master_data_for_sourcing_api_key: &master_data_for_sourcing_api_key '****'
master_data_for_sourcing_client_id: &master_data_for_sourcing_client_id '****'
master_data_for_sourcing_secret: &master_data_for_sourcing_secret '****'
user: &user '****'
passwordAdapter: &passwordAdapter '****'
remove_old: False
filenames_as_timestamp: False
api: !include extractor/developer_settings.yaml
There is also a reference to the developer_settings file. For more info on how to configure that file please refer to Extractor Specifics
The extractor can also be used as a command line tool. To use the tool, you need to provide a YAML configuration file that specifies the API endpoint, parameters, headers, and authentication credentials. Here's an example:
python main.py --model_name receipt_updated_range_async --date-from 2023-11-29 --date-to 2023-11-30
The extractor expects a model_name or one of the flags: --allp2p or --allsourcing. If none of these is provided, the extractor will terminate and request one option.
Only a few models can be run with the --delta
option due to how the endpoints are called. They are:
Within the rest of the models, only a few can be filtered by creation date. They are:
The rest of the models can't be filtered by date, so each extraction will download all information. They are: