TypeError: can't concat str to bytes
-
I am trying to run below code from my python terminal, but I am getting "TypeError: can't concat str to bytes" error. Could you please highlight where I am making mistake.
NOTE: I have given my trading account username and password in payload variableimport http.client
import mimetypes
conn = http.client.HTTPSConnection("apiconnect.angelbroking.com")
payload = {"clientcode":"client","password":"pwd"}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-UserType': 'USER',
'X-SourceID': 'WEB',
'X-ClientLocalIP': '192.168.29.25',
'X-ClientPublicIP': '49.37.76.50',
'X-MACAddress': '68-3E-26-1F-C5-D8',
'X-PrivateKey': 'ZWGnafyY'
}
conn.request("POST","/rest/auth/angelbroking/user/v1/loginByPassword",payload,headers)res = conn.getresponse()
data = res.read()
print(data.decode("utf-8")) -
HI @praveen1006 please go through below thread.
https://smartapi.angelbroking.com/topic/52/how-to-use-this-smart-api/5 -
@admin my client id is NIHKA1033
-
HI @praveen1006 We have tested it and its working fine fro our end kindly share the client id our team will connect to you.
-
@admin how long will this take
-
HI @praveen1006 We need to debug the code its hard to evaluate here.