dkutils.veeva_network_api.veeva_network_client module¶
- exception dkutils.veeva_network_api.veeva_network_client.VeevaNetworkException[source]¶
Bases:
Exception
- class dkutils.veeva_network_api.veeva_network_client.VeevaNetworkClient(dns, username, password, version)[source]¶
Bases:
object
Create a client for accessing Veeva Network. This class should not be instantiated directly. You should use either VeevaSourceSubscriptionClient or VeevaTargetSubscriptionClient
- Parameters
dns (str) – is the URL for your API service
username (str) – the user ID for Network; for example, john.smith@veevanetwork.com.
password (str) – the password for the user ID.
version (str) – is the API version
- Raises
HTTPError – If the request fails
ValueError – If the authorization header is not available
- __init__(dns, username, password, version)[source]¶
Create a client for accessing Veeva Network. This class should not be instantiated directly. You should use either VeevaSourceSubscriptionClient or VeevaTargetSubscriptionClient
- Parameters
dns (str) – is the URL for your API service
username (str) – the user ID for Network; for example, john.smith@veevanetwork.com.
password (str) – the password for the user ID.
version (str) – is the API version
- Raises
HTTPError – If the request fails
ValueError – If the authorization header is not available
- class dkutils.veeva_network_api.veeva_network_client.VeevaNetworkSubscriptionType(value)[source]¶
Bases:
str
,enum.Enum
An enumeration.
- SOURCE = 'source'¶
- TARGET = 'target'¶
- class dkutils.veeva_network_api.veeva_network_client.VeevaSourceSubscriptionClient(dns, username, password, subscription_name, system_name, version='v16.0')[source]¶
Bases:
dkutils.veeva_network_api.veeva_network_client.VeevaNetworkClient
Create a client that enables you to manage source subscriptions that import and export data to and from the Veeva Network.
- Parameters
dns (str) – is the URL for your API service
username (str) – the user ID for Network; for example, john.smith@veevanetwork.com.
password (str) – the password for the user ID.
system_name (str) – is the unique name of the system
subscription_name (str) – is the unique name of the subscription
version (str) – is the API version
- Raises
HTTPError – If the request fails
ValueError – If the authorization header is not available
- __init__(dns, username, password, subscription_name, system_name, version='v16.0')[source]¶
Create a client that enables you to manage source subscriptions that import and export data to and from the Veeva Network.
- Parameters
dns (str) – is the URL for your API service
username (str) – the user ID for Network; for example, john.smith@veevanetwork.com.
password (str) – the password for the user ID.
system_name (str) – is the unique name of the system
subscription_name (str) – is the unique name of the subscription
version (str) – is the API version
- Raises
HTTPError – If the request fails
ValueError – If the authorization header is not available
- retrieve_network_process_job(job_resp_id)[source]¶
Retrieve the status of a source or target subscription job. This function will poll until the job has reached a terminal state.
- Parameters
job_resp_id (str) – is the unique ID of the job you want to retrieve status on
- Raises
HTTPError – If the request fails
ValueError – If the job reaches a terminal status other than COMPLETE
- Returns
A dictionary containing the information about the job:
{ "filesProcessed" : 1, "errorCount" : 0, "subscriptionName" : "CRM_Import", "completed_date" : "2019-12-18T22:42:32.000Z", "job_status" : "COMPLETE", "job_id" : 10537, "jobResultSummary" : { "CUSTOMKEY" : { "total" : 2, "recordsUpdated" : 0, "recordsSkipped" : 2, "newRecordsAdded" : 0, "recordsInvalidated" : 0, "recordsMerged" : 0 }, "HCP" : { "total" : 1, "recordsUpdated" : 0, "recordsSkipped" : 1, "recordsMerged" : 0, "recordsInvalidated" : 0, "newRecordsAdded" : 0 }, "ADDRESS" : { "total" : 1, "recordsUpdated" : 0, "recordsSkipped" : 1, "recordsInvalidated" : 0, "newRecordsAdded" : 0, "recordsMerged" : 0 } }, "durationInMilliseconds" : 3000, "created_date" : "2019-12-18T22:42:29.000Z", "subscriptionId" : 117, "processedDataSummary" : { "HCP" : 1, "ADDRESS" : 1 }, "type" : "MANUAL", "dataLoadSummary" : { "ADDRESS" : { "rowsRead" : 1, "rowsParsed" : 1 }, "HCP" : { "rowsParsed" : 1, "rowsRead" : 1 } }, "badRecordCount" : 0, "recordCount" : 2, "matchSummary" : { "HCP" : { "ACT" : 1, "notMatched" : 0, "ASK" : 0 }, "HCO" : { "ACT" : 0, "notMatched" : 0, "ASK" : 0 } }, "responseStatus" : "SUCCESS" }
- Return type
dict
- run_subscription_process()[source]¶
This API enables you to create a source or target subscription job. Note: This API requires system administrator or API-only permissions.
- Raises
HTTPError – If the request fails
- Returns
the unique ID of the job generated for the source subscription you specified.
- Return type
str
- class dkutils.veeva_network_api.veeva_network_client.VeevaTargetSubscriptionClient(dns, username, password, subscription_name, system_name, version='v16.0')[source]¶
Bases:
dkutils.veeva_network_api.veeva_network_client.VeevaSourceSubscriptionClient
Create a client that enables you to manage target subscriptions that import and export data to and from the Veeva Network.
- Parameters
dns (str) – is the URL for your API service
username (str) – the user ID for Network; for example, john.smith@veevanetwork.com.
password (str) – the password for the user ID.
system_name (str) – is the unique name of the system
subscription_name (str) – is the unique name of the subscription
version (str) – is the API version
- Raises
HTTPError – If the request fails
ValueError – If the authorization header is not available
- __init__(dns, username, password, subscription_name, system_name, version='v16.0')[source]¶
Create a client that enables you to manage target subscriptions that import and export data to and from the Veeva Network.
- Parameters
dns (str) – is the URL for your API service
username (str) – the user ID for Network; for example, john.smith@veevanetwork.com.
password (str) – the password for the user ID.
system_name (str) – is the unique name of the system
subscription_name (str) – is the unique name of the subscription
version (str) – is the API version
- Raises
HTTPError – If the request fails
ValueError – If the authorization header is not available
- retrieve_network_process_job(job_resp_id)[source]¶
Retrieve the status of a source or target subscription job. This function will poll until the job has reached a terminal state.
- Parameters
job_resp_id (str) – is the unique ID of the job you want to retrieve status on
- Returns
A dictionary containing the information about the job. A dictionary similar to the following is returned:
{ "responseStatus": "SUCCESS", "subscriptionId": 15, "subscriptionName": "targetSubscriptionCustomer", "durationInMilliseconds": 2000, "type": "MANUAL", "errorCount": 0, "badRecordCount": 0, "exportReferenceCount": 0, "exportFull": True, "exportIncludeReference": False, "exportUpdatedChildOnly": False, "exportSetSubscriptionStateOnFull": False, "exportFormat": "CSV", "exportReferenceVersion": "4", "exportActiveOnly": False, "jobExportCount": { "LICENSE": 3961, "RELATION": 333, "HCO": 819, "HCP": 1060, "ADDRESS": 1801, "EXTERNALKEYS": 8038 }, "job_id": 10563, "job_status": "COMPLETE", "created_date": "2016-11-17T10:58:49.000-08:00", "data_revision_first": "0", "data_revision_last": "929335226137870335", "export_package_path": "export/change_request/targetSubscriptionCustomer/exp_000001C5.zip", "total_records_exported": "1879", "completed_date": "2016-11-17T10:58:51.000-08:00", "export_archive": "individual", "exportFormatDelimiter":"|", "exportFormatTextQualifier":""" }
- Return type
dict
- Raises
HTTPError – If the request fails
ValueError – If the job reaches a terminal status other than COMPLETE
- dkutils.veeva_network_api.veeva_network_client.create_veeva_network_subscription_client(dns=None, username=None, password=None, subscription_name=None, subscription_type=None, system_name=None, version=None)[source]¶
Create a client that enables you to manage subscriptions that import and export data to and from the Veeva Network.
- Parameters
dns (str, opt) – The URL for your API service, if this variable is absent the the value will be obtained from the environment variable VEEVA_DNS
username (str) – The user ID for Network; for example, john.smith@veevanetwork.com. if this variable is absent the the value will be obtained from the environment variable VEEVA_USERNAME
password (str, opt) – The password for the user ID. if this variable is absent the the value will be obtained from the environment variable VEEVA_PASSWORD
system_name (str, opt) – The unique name of the system if this variable is absent the the value will be obtained from the environment variable VEEVA_SYSTEM_NAME
subscription_name (str, opt) – The unique name of the subscription if this variable is absent the the value will be obtained from the environment variable VEEVA_SUBSCRIPTION_NAME
subscription_type (VeevaNetworkSubscriptionType) – Ff this variable is absent then the value will be obtained from the environment variable VEEVA_SUBSCRIPTION_TYPE the type of subscription
version (str, opt) – The API version if this variable is absent the the value will be obtained from the environment variable
- Raises
HTTPError – If the request fails
VeevaNetworkException – If subscription_type is not VeevaNetworkSubscriptionType.SOURCE or VeevaNetworkSubscriptionType.TARGET. If the authorization header is not available
- dkutils.veeva_network_api.veeva_network_client.run_subscription_job(dns=None, username=None, password=None, subscription_name=None, subscription_type=None, system_name=None, version=None)[source]¶
This function will run a subscription job and poll until the job has reached a terminal state.
- Parameters
dns (str, opt) – is the URL for your API service, if this variable is absent the the value will be obtained from the environment variable VEEVA_DNS
username (str) –
- the user ID for Network; for example, john.smith@veevanetwork.com. if this variable is absent the the value will
be obtained from the environment variable VEEVA_USERNAME
password (str, opt) – the password for the user ID. if this variable is absent the the value will be obtained from the environment variable VEEVA_PASSWORD
system_name (str, opt) – is the unique name of the system if this variable is absent the the value will be obtained from the environment variable VEEVA_SYSTEM_NAME
subscription_name (str, opt) – is the unique name of the subscription if this variable is absent the the value will be obtained from the environment variable VEEVA_SUBSCRIPTION_NAME
subscription_type (VeevaNetworkSubscriptionType if this variable is absent the the value will be obtained from the) – environment variable VEEVA_SUBSCRIPTION_TYPE the type of subscription
version (str, opt) – is the API version if this variable is absent the the value will be obtained from the environment variable
- Raises
HTTPError – If the request fails
ValueError – If the job reaches a terminal status other than COMPLETE
- Returns
A dictionary containing the information about the job. For a source subscription the will be similar to the following:
{ "filesProcessed" : 1, "errorCount" : 0, "subscriptionName" : "CRM_Import", "completed_date" : "2019-12-18T22:42:32.000Z", "job_status" : "COMPLETE", "job_id" : 10537, "jobResultSummary" : { "CUSTOMKEY" : { "total" : 2, "recordsUpdated" : 0, "recordsSkipped" : 2, "newRecordsAdded" : 0, "recordsInvalidated" : 0, "recordsMerged" : 0 }, "HCP" : { "total" : 1, "recordsUpdated" : 0, "recordsSkipped" : 1, "recordsMerged" : 0, "recordsInvalidated" : 0, "newRecordsAdded" : 0 }, "ADDRESS" : { "total" : 1, "recordsUpdated" : 0, "recordsSkipped" : 1, "recordsInvalidated" : 0, "newRecordsAdded" : 0, "recordsMerged" : 0 } }, "durationInMilliseconds" : 3000, "created_date" : "2019-12-18T22:42:29.000Z", "subscriptionId" : 117, "processedDataSummary" : { "HCP" : 1, "ADDRESS" : 1 }, "type" : "MANUAL", "dataLoadSummary" : { "ADDRESS" : { "rowsRead" : 1, "rowsParsed" : 1 }, "HCP" : { "rowsParsed" : 1, "rowsRead" : 1 } }, "badRecordCount" : 0, "recordCount" : 2, "matchSummary" : { "HCP" : { "ACT" : 1, "notMatched" : 0, "ASK" : 0 }, "HCO" : { "ACT" : 0, "notMatched" : 0, "ASK" : 0 } }, "responseStatus" : "SUCCESS" }
For a target source a dictionary similar to the following is returned:
{ "responseStatus": "SUCCESS", "subscriptionId": 15, "subscriptionName": "targetSubscriptionCustomer", "durationInMilliseconds": 2000, "type": "MANUAL", "errorCount": 0, "badRecordCount": 0, "exportReferenceCount": 0, "exportFull": True, "exportIncludeReference": False, "exportUpdatedChildOnly": False, "exportSetSubscriptionStateOnFull": False, "exportFormat": "CSV", "exportReferenceVersion": "4", "exportActiveOnly": False, "jobExportCount": { "LICENSE": 3961, "RELATION": 333, "HCO": 819, "HCP": 1060, "ADDRESS": 1801, "EXTERNALKEYS": 8038 }, "job_id": 10563, "job_status": "COMPLETE", "created_date": "2016-11-17T10:58:49.000-08:00", "data_revision_first": "0", "data_revision_last": "929335226137870335", "export_package_path": "export/change_request/targetSubscriptionCustomer/exp_000001C5.zip", "total_records_exported": "1879", "completed_date": "2016-11-17T10:58:51.000-08:00", "export_archive": "individual", "exportFormatDelimiter":"|", "exportFormatTextQualifier":""" }
- Return type
dict