osparamatrix / ks-orderapi-python

47 stars 59 forks source link

Unable to generate OTT using requests #38

Closed algowhizz closed 3 years ago

algowhizz commented 3 years ago

I am trying to generate OTT using the method show in video :https://youtu.be/_w-p17Oq6lE?t=2014 But I am getting following error :

headers = {
    'accept' : 'application/json',
    'consumerKey': consumer_key,
    'ip' : ip,
    'appId': app_id,
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ' + access_token,
    }
data = '{"userid":"myid","password":"mypassword"}'
response = requests.get('https://tradeapi.kotaksecurities.com/apim/session/1.0/session/login/userid', headers=headers, data=data)
response.json()
{'fault': {'code': 405,
  'type': 'Status report',
  'message': 'Runtime Error',
  'description': 'Method not allowed for given API resource'}}

What should be done?

kalilinux-png commented 3 years ago

@algowhizz please check out this video you might find it useful if not let me know https://youtu.be/JYQ0lDyIbwM

algowhizz commented 3 years ago

@kalilinux-png , thanks but your implementation wasn't the one I was looking for.

Anyhow, my issue got resolved because I was supposed to be using requests.post instead of resquests.get

Thanks.

kalilinux-png commented 3 years ago

Welcome brother @algowhizz