Our Python library is a powerful wrapper around our REST API. We’ve build out key examples to detail how Verve can accelerate your team’s development practices.

Getting Set Up

Installation

Your Prewitt Ridge customer team will provide you with a .env environment file, containing key information required to authenticate against the correct Verve instance. They will also provide you with the latest Python libraries, which you should install at the root of your project directory.

Import and Authentication

First, ensure the relevant .env file as provided by your team is located at the top level directory of your script. In the case of a Jupyter notebook, place it in the same directory as the notebook.

For Interactive login, use the following snippet:

import verve_py.verve as verve_py
verve_py.config.headers.login()
PY

First Example: Change a Verification Event’s Status

In this example, we’ll pull a known Verification Event ID, review its status, and push a change to it

First, start by retrieving the values:

# Known IDs of Verification Event and Atomic
ve_analysis_id = 21
atomic_totalmass_id = 7

# Pull down the Atomic
atomic_mass = verve_py.get.atomic_did_did(atomic_totalmass_id)
 
# Pull down the Item
ve_analysis = verve_py.get.item_did_did(ve_analysis_id)
PY

Next, review the atomics we plan to update. You can find out more about the Atomic data model and Item data model in their respective docs.

# State it's verification status.
print("Verification status is:", ve_analysis['verification_status'])

# State the value of the atomic we're looking at
print("Atomic value is: ", atomic_mass['fvalue'])
PY

Finally, perform a quick check and update. In this case, if the mass is greater than we expect, the status changes to Verified.

# Check mass and update verification status accordingly
if total_mass > 49:
    payload = json.dumps({"verification_status": "verified"})
else:
    payload = json.dumps({"verification_status": "failed"})
    
resp = verve_py.put.item_did_did(ve_analysis_id, payload)
PY