File size: 894 Bytes
1d058ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
import json

def upload_file(file_path, file_type):
    # Here you can implement the logic for uploading the file
    print(f"Uploading {file_type} file: {file_path}")

# Open the JSON file and load the data
with open("respons12.json", "r") as f:
    data = json.load(f)

# Extract information from the data
receipt = data['receipts'][0]
items = receipt['items']

# Print relevant information
print(f"Your purchase at {receipt['merchant_name']}")
print("_" * 30)
print(f"Merchant address: {receipt['merchant_address']}")
print(f"Merchant phone: {receipt['merchant_phone']}")
print(f"Region: {receipt['region']}")

# Optionally, print the items and their prices
# for item in items:
#     print(f"{item['description']} - ${item['amount']}")

# Upload PDF and images
pdf_path = "your_pdf_file.pdf"
image_path = "your_image_file.jpg"

upload_file(pdf_path, "PDF")
upload_file(image_path, "image")