Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ENDPOINT_URL = 'https://tash.example.com/api_v1/journal'
- Header = {'Api-key': 'abc1234'}
- with open('coa.csv', 'r') as csv_ledger:
- r = csv.DictReader(csv_ledger)
- data = [dict(d) for d in r]
- groups = []
- for k, g in groupby(data, lambda r:
- (r['Code'],r['Description'],r['Account_Type_ID'])):
- groups.append({
- "date": "2018-10-10",
- "name": "gfgfh",
- "code": k[0],
- "desc": k[1],
- "account_type_id": k[2],
- })
- post_api = requests.post(ENDPOINT_URL, json=groups,headers=Header)
Add Comment
Please, Sign In to add comment