from dataclasses import field
Python Api Client for Vectorize For more information, please visit https://vectorize.io
Python 3.8+
pip install vectorize-client
Then import the package:
import vectorize_client
Please follow the installation procedure and then run the following:
import vectorize_client as v
TOKEN = '<your-token>'
ORG = '<your-org-id>'
with v.ApiClient(v.Configuration(access_token=TOKEN)) as api:
pipelines = v.PipelinesApi(api)
response = pipelines.get_pipelines(ORG)
print("Found" + str(len(response.data)) + " pipelines")
All URIs are relative to https://api.vectorize.io/v1
See the full reference for more information.
First, export your token and org id as environment variables:
export VECTORIZE_TOKEN=<your-token>
export VECTORIZE_ORG=<your-org-id>
Then, initialize the client with your token and org id:
import os
TOKEN = os.environ['VECTORIZE_TOKEN']
ORG = os.environ['VECTORIZE_ORG']
Set the file you want to extract data from:
export FILE=<path-to-file>
Then, run the following code:
import os
import vectorize_client as v
import time, logging
TOKEN = os.environ['VECTORIZE_TOKEN']
ORG = os.environ['VECTORIZE_ORG']
FILE = os.environ['FILE']
with v.ApiClient(v.Configuration(access_token=TOKEN)) as api:
with open(FILE, 'rb') as file:
data = file.read()
extraction_id = v.ExtractionApi(api).start_extraction(ORG, data).extraction_id
print(f"Extraction started with id {extraction_id}")
while True:
extraction = v.ExtractionApi(api).get_extraction_result(ORG, extraction_id)
if extraction.ready:
extracted_data = extraction.data
if extracted_data.success:
print(extracted_data)
break
else:
raise Exception(extracted_data.error)
print("Waiting for extraction to complete...")
time.sleep(1)