Header File Examples
Introduces the structure of the ucwi_config and ucwi_auth header files that need to be imported.
Python Example (ucwi_config)
The following example shows the Unified Content Web-Service Inspector
(UCWI) configuration file ucwi_config file example as a header file.
class UCWIConfig: access_key = "<access_key>" secret_key = "<secret_key>" protocol = "https" ucwi_host = "<ip address of ucwi_host>" ucwi_port = <port_number> callback_url = "http://<ip address of callback url>:<port number>/callback" base_url = "{0}://{1}:{2}".format(protocol, ucwi_host, ucwi_port)
Python Example (ucwi_auth)
The following example shows the Unified Content Web-Service Inspector
(UCWI) configuration file ucwi_auth file example as a header file.
import time import hmac import hashlib from ucwi_config import UCWIConfig def get_auth(access_key, secret_key, timestamp): token_source = secret_key + timestamp token = hmac.new( secret_key.encode('utf-8'), token_source.encode('utf-8'), hashlib.sha256).hexdigest() return "SKG {0}:{1}".format(access_key, token) def get_headers(): timestamp = "{0:.0f}".format(time.time()) auth = get_auth( UCWIConfig.access_key, UCWIConfig.secret_key, timestamp) headers = { "x-skg-timestamp": timestamp, "Authorization": auth, } return headers