40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
import requests
|
|
|
|
api_key = "971dcea6c47445f6f7405fa2d14e116b1d81dae6c10330571e8d4220c013b523"
|
|
file_path = "test.pdf"
|
|
|
|
# Try with Bearer
|
|
try:
|
|
with open(file_path, 'rb') as f:
|
|
response = requests.post(
|
|
'https://aiinfinite.in/process-invoice',
|
|
files={'file': f},
|
|
headers={'Authorization': f'Bearer {api_key}'}
|
|
)
|
|
print(f"Bearer: {response.status_code}")
|
|
except Exception as e:
|
|
print(f"Bearer error: {e}")
|
|
|
|
# Try without Bearer
|
|
try:
|
|
with open(file_path, 'rb') as f:
|
|
response = requests.post(
|
|
'https://aiinfinite.in/process-invoice',
|
|
files={'file': f},
|
|
headers={'Authorization': api_key}
|
|
)
|
|
print(f"Key only: {response.status_code}")
|
|
except Exception as e:
|
|
print(f"Key only error: {e}")
|
|
|
|
# Try as X-API-Key
|
|
try:
|
|
with open(file_path, 'rb') as f:
|
|
response = requests.post(
|
|
'https://aiinfinite.in/process-invoice',
|
|
files={'file': f},
|
|
headers={'X-API-Key': api_key}
|
|
)
|
|
print(f"X-API-Key: {response.status_code}")
|
|
except Exception as e:
|
|
print(f"X-API-Key error: {e}") |