1- from dataclasses import field
2-
31# Vectorize Client
4- Python Api Client for Vectorize
5- For more information, please visit [ https://vectorize.io ] ( https://vectorize.io )
6-
7- ## Requirements.
2+ Python Api Client for [ Vectorize] ( https://vectorize.io ) .
3+ For the full documentation, please visit [ docs.vectorize.io] ( https://docs.vectorize.io/api/api-getting-started ) .
84
9- Python 3.8+
105
11- ## Installation & Usage
6+ ## Installation
127``` sh
138pip install vectorize-client
149```
@@ -20,8 +15,7 @@ import vectorize_client
2015
2116## Getting Started
2217
23- Please follow the [ installation procedure] ( #installation--usage ) and then run the following:
24-
18+ List all your pipelines:
2519``` python
2620import vectorize_client as v
2721
@@ -34,62 +28,5 @@ with v.ApiClient(v.Configuration(access_token=TOKEN)) as api:
3428 print (" Found" + str (len (response.data)) + " pipelines" )
3529```
3630
37- ## Documentation for API Endpoints
38-
39- All URIs are relative to * https://api.vectorize.io/v1 *
40-
41- See the full [ reference] ( https://vectorize.readme.io/reference ) for more information.
42-
43- ## Usage
44-
45- First, export your token and org id as environment variables:
46-
47- ``` sh
48- export VECTORIZE_TOKEN=< your-token>
49- export VECTORIZE_ORG=< your-org-id>
50- ```
51- Then, initialize the client with your token and org id:
52-
53- ``` python
54- import os
55- TOKEN = os.environ[' VECTORIZE_TOKEN' ]
56- ORG = os.environ[' VECTORIZE_ORG' ]
57- ```
58-
59- ### Extraction
60-
61- Set the file you want to extract data from:
62-
63- ``` sh
64- export FILE=< path-to-file>
65- ```
66-
67- Then, run the following code:
68- ``` python
69- import os
70- import vectorize_client as v
71- import time, logging
72-
73- TOKEN = os.environ[' VECTORIZE_TOKEN' ]
74- ORG = os.environ[' VECTORIZE_ORG' ]
75- FILE = os.environ[' FILE' ]
76-
77- with v.ApiClient(v.Configuration(access_token = TOKEN )) as api:
78- with open (FILE , ' rb' ) as file :
79- data = file .read()
80- extraction_id = v.ExtractionApi(api).start_extraction(ORG , data).extraction_id
81- print (f " Extraction started with id { extraction_id} " )
82- while True :
83- extraction = v.ExtractionApi(api).get_extraction_result(ORG , extraction_id)
84- if extraction.ready:
85- extracted_data = extraction.data
86- if extracted_data.success:
87- print (extracted_data)
88- break
89- else :
90- raise Exception (extracted_data.error)
91- print (" Waiting for extraction to complete..." )
92- time.sleep(1 )
93- ```
94-
31+ Visit [ docs.vectorize.io] ( https://docs.vectorize.io/api/api-getting-started ) to learn more about the API.
9532
0 commit comments