Skip to content

Commit ac34952

Browse files
Merge pull request #1075 from adamtheturtle/example-readme
Put a getting started guide in the README
2 parents 38e55a5 + cfbf46f commit ac34952

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,33 @@ Installation
1515
This is tested on Python 3.7+.
1616
Get in touch with ``adamdangoor@gmail.com`` if you would like to use this with another language.
1717

18+
Getting Started
19+
---------------
20+
21+
.. code:: python
22+
23+
import io
24+
25+
from vws import VWS, CloudRecoService
26+
27+
vws_client = VWS(server_access_key='...', server_secret_key='...')
28+
cloud_reco_client = CloudRecoService(client_access_key='...', client_secret_key='...')
29+
name = 'my_image_name'
30+
31+
with open('/path/to/image.png', 'rb') as my_image_file:
32+
my_image = io.BytesIO(my_image_file.read())
33+
34+
target_id = vws_client.add_target(
35+
name=name,
36+
width=1,
37+
image=my_image,
38+
)
39+
vws_client.wait_for_target_processed(target_id=target_id)
40+
matching_targets = cloud_reco_client.query(image=my_image)
41+
42+
assert matching_targets[0]['target_id'] == target_id
43+
44+
1845
Full Documentation
1946
------------------
2047

0 commit comments

Comments
 (0)