Skip to content
Snippets Groups Projects
test-ingress.py 1000 B
Newer Older
import filecmp
import json
import os
import sys

from client import SmartDataContextAPIClient

CLIENT_CERTIFICATE="client.pem"
CLIENT_CERTIFICATE_KEY="client.key"
API_URL="https://web/"

# Create a new SmartDataContextClient, passing a custom URL for the API and the certificates to access the domain
# The parameter verifyCertificate allows using self-signed certificates for development and test environments.
# Should not be used in production ideally
client = SmartDataContextAPIClient(cert_file=CLIENT_CERTIFICATE, key_file=CLIENT_CERTIFICATE_KEY, url=API_URL, verifyCertificate=False,
                                   logfile="requests.log")

# To find all SmartDataContext associated with the vehicle
smartDataContextForSources = client.findSmartDataContext(smartDataSources=['a3edc4456f'])
print(f"Retrieved SmartDataContext for a3edc4456f: {len(smartDataContextForSources)} \n {json.dumps(smartDataContextForSources, indent=2)}")
if len(smartDataContextForSources) != 3:
    sys.exit(1)