-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.py
29 lines (24 loc) · 873 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
from pprint import pprint
from aspose_barcode_cloud import (
BarcodeApi,
ApiClient,
Configuration,
EncodeBarcodeType,
CodeLocation,
DecodeBarcodeType,
)
config = Configuration(
client_id="Client Id from https://dashboard.aspose.cloud/applications",
client_secret="Client Secret from https://dashboard.aspose.cloud/applications",
access_token=os.environ.get("TEST_CONFIGURATION_ACCESS_TOKEN"), # Only for testing in CI, remove this line
)
api = BarcodeApi(ApiClient(config))
# Generate barcode
response = api.get_barcode_generate(EncodeBarcodeType.QR, "Example", text_location=CodeLocation.NONE)
with open("example.png", "wb") as f:
f.write(response.data)
print("Barcode saved to file 'example.png'")
# Recognize barcode
response = api.scan_barcode("example.png", decode_types=[DecodeBarcodeType.QR])
pprint(response)