-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_withdrawals.py
51 lines (39 loc) · 1.01 KB
/
make_withdrawals.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
import requests
import json
import config
apiKey = os.environ["capitalone_api_key"]
accountId = os.environ["accountId"]
accountId2 = os.environ["accountId2"]
accountId3 = os.environ["accountId3"]
url_with = 'http://api.reimaginebanking.com/accounts/{}/withdrawals?key={}'.format(accountId3,apiKey)
withdrawl = {
"medium": "balance",
"transaction_date": "2018-10-27",
"status": "pending",
"amount": 10,
"description": "string"
}
# Create a new transaction
response = requests.post(
url_with,
data=json.dumps(withdrawl),
headers={'content-type':'application/json'},
)
print(response)
if response.status_code == 201:
print('withdrawl made')
#python make.withdrawals.py
# Output
# [
# {
# "_id": "5bd4db6cf0cec56abfa4410d",
# "medium": "balance",
# "transaction_date": "2018-10-27",
# "status": "pending",
# "amount": 1995,
# "description": "string",
# "type": "withdrawal",
# "payer_id": "5bd48ec6f0cec56abfa440e9"
# }
# ]