Submit a thing that works but isn't what I want
This commit is contained in:
parent
3fb1e33dbb
commit
36413aafd0
26
invoice.py
26
invoice.py
@ -9,6 +9,8 @@
|
||||
from csv import DictReader
|
||||
import datetime
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import requests
|
||||
import textwrap
|
||||
@ -52,9 +54,25 @@ requestbody = {
|
||||
for k,v in timesheet.items():
|
||||
print(k)
|
||||
for i,h in v.items():
|
||||
requestbody["items"] += {
|
||||
"name": f""
|
||||
}
|
||||
print(f'{ i } - { h }')
|
||||
requestbody["items"].append({
|
||||
"name": f"{ k } - { i }",
|
||||
"quantity": h,
|
||||
"unit_cost": rate
|
||||
})
|
||||
print(f' { i } - { h }')
|
||||
|
||||
# Submit said request
|
||||
resp = requests.post(
|
||||
url = 'https://invoice-generator.com',
|
||||
json = json.dumps(requestbody),
|
||||
headers = {
|
||||
"Authorization": f"Bearer { os.environ['INVOICE_GENERATOR_APIKEY'] }"
|
||||
}
|
||||
)
|
||||
|
||||
if not resp.status_code == 200:
|
||||
print(resp)
|
||||
quit()
|
||||
|
||||
with open('out.pdf', 'w') as f:
|
||||
f.write(resp.text)
|
||||
|
Loading…
x
Reference in New Issue
Block a user