Package: vantiqsdk
Vantiq SDK for PythonTheVantiqPython SDK is a Python package that provides an
API into a Vantiq system from Python applications.  The SDK connects to a
Vantiq system using theVantiq REST API.InstallationThe SDK is installed from the PyPI repo.  To install this into your system,
usepip install vantiqsdkNote: depending on your local environment, you may need to usepip3instead ofpip, or whatever is appropriate to install into your
virtual environment.The Vantiq SDK for Python requires Python version 3.10 or better.
It is built usingasyncio,aiohttp, andwebsockets. In the documentation
that follows, methods marked asAsyncmust be awaited. For more information
aboutasyncioandawait, please see thePythonasynciodocumentation).Quick StartYou will need valid credentials on a Vantiq server in the form of a
username and password or access token.  If you have a private Vantiq server,
contact your administrator for credentials.  If you wish to use the
Vantiq public cloud, contactsupport@vantiq.com.The first step is to create an instance of the Vantiq SDK providing the URL of the Vantiq server to connect:fromvantiqsdkimportVantiq,VantiqResources,VantiqResponseimportvantiqsdkserver:str="https://dev.vantiq.com"vantiq:Vantiq=Vantiq(server)whereserveris the full URL for the Vantiq server to connect to, such ashttps://dev.vantiq.com/.
An optional second argument is the version of the API to connect to.
If not specified, this defaults to the latest version, currently1.
At this point, theVantiqinstance has not yet connected to the server.To establish a connection to the server, use theauthenticatemethod, e.g.,username="joe@user"password="my-secr3t-passw0rd!#!"awaitvantiq.authenticate(username,password)Theusernameandpasswordare the same credentials used to log into the system.
Note the username and password are not stored either in-memory or persistently after
this authentication call.  After successfully authenticating with the system,
theVantiqinstance stores an in-memory access token that subsequent API calls
will use.Now, you are able to perform any SDK calls to the Vantiq server.  The async methods
on the SDK classes can be immediately awaited to run in, effectively, a synchronous
fashion, or they can return anAwaitablethat can beawaitedlater.vr:VantiqResponse=awaitvantiq.select(VantiqResources.TYPES)Alternatively,to_await=vantiq.select(VantiqResources.TYPES)...vr:VantiqResponse=awaitto_awaitIn either case, the response to the operation is available
in the VantiqResponse instance.DocumentationFor the full documentation on the SDK, see theSDK API Reference.DevelopersThe project is set up as agradleproject.  To run the tests, use./gradlew testor./gradlew.bat testin a windows environment.The tests run will run a mocked version. To execute tests against aliveserver,
define the following gradle properties in your ~/.gradle/gradle.properties file:# Python project valuesTestVantiqServer=<Vantiq server url> # Only do the base URL. Ex http://localhost:8080/TestAccessToken=<access token from that Vantiq system>TestVantiqUsername=<Vantiq user name>TestVantiqPassword=<Password for that Vantiq user>Alternatively, when running directly, use the following environment variables:VANTIQ_URL <Vantiq erver url>
VANTIQ_ACCESS_TOKEN <Access token from that Vantiq system>
VANTIQ_USERNAME <Vantiq user name>
VANTIQ_PASSWORD <Password for that Vantiq user>Copyright and LicenseCopyright © 2022 Vantiq, Inc.  Code released under theMIT license.