Step1: Install requests package
after installation you should see something like this when you perform
pip list from command line
$ pip list
Package Version
------------ -------------------
certifi 2019.9.11
chardet 3.0.4
Click 7.0
idna 2.8
itsdangerous 1.1.0
MarkupSafe 1.1.1
pip 19.3.1
**requests 2.22.0**
setuptools 41.6.0.post20191030
urllib3 1.25.7
Werkzeug 0.16.0
wheel 0.33.6
wincertstore 0.2
Step 2 : Run the below code to check whether post request works alright,
Please find below an example of python POST request,
import requests
url = 'https://www.w3schools.com/python/demopage.php'
myobj = {'somekey': 'somevalue'}
x = requests.post(url, data = myobj)
print(x.text)
Step3 : Your code using requests shown below,
import requests
url = 'http://192.168.12.80:8080/1.0/kb/accounts/a6c08c2c-f3eb-456a-a681-6e5262262e94/payments?paymentMethodId=810d4eae-4668-4c6a-897c-178c041eb67f"'
myobj = {'transactionType': 'AUTHORIZE','amount':'$user','currency':'INR','transactionExternalKey':'$id'}
headers = {'accept': 'application/json','X-Killbill-CreatedBy': 'demo','authorization':'Basic YWRtaW46cGFzc3dvcmQ=','X-Killbill-ApiKey': 'abcd','X-Killbill-ApiSecret': 'dcba', 'Content-Type': 'application/json'}
x = requests.post(url, data = myobj, headers=headers)
print(x.text)