SHARE
TWEET

Untitled

a guest Jan 11th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ENDPOINT_URL = 'https://tash.example.com/api_v1/journal'
  2. Header = {'Api-key': 'abc1234'}
  3.  
  4. with open('coa.csv', 'r') as csv_ledger:
  5.     r = csv.DictReader(csv_ledger)
  6.     data = [dict(d) for d in r]
  7.  
  8.     groups = []
  9.  
  10.     for k, g in groupby(data, lambda r:
  11. (r['Code'],r['Description'],r['Account_Type_ID'])):
  12.         groups.append({
  13.             "date": "2018-10-10",
  14.             "name": "gfgfh",
  15.             "code": k[0],
  16.             "desc": k[1],
  17.             "account_type_id": k[2],
  18.         })
  19.  
  20. post_api = requests.post(ENDPOINT_URL, json=groups,headers=Header)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top