See if this python code helps. The XXXX is assigned when you get your TD API ID (unique to you I think), obviously myloginname and mypassword is specific to you as well.
The login function returns the login response as well as the session object. That session object has to be passed into the subsequent call to ensure it's already authenticated. This is as straightforward as a http post goes, you can literally put it into a curl and it'll still work.
def getQuotes(mysymbol,s):
returnval=s.get("
https://apis.tdameritrade.com/apps/100/Quote?source=XXXX&symbol="+mysymbol)
returntext = returnval.text
returntext2close=returntext[returntext.index('<last>')+6:returntext.index('</last>')]
returntext2open=returntext[returntext.index('<open>')+6:returntext.index('</open>')]
returntext2volume=returntext[returntext.index('<volume>')+8:returntext.index('</volume>')]
returntext2high=returntext[returntext.index('<high>')+6:returntext.index('</high>')]
returntext2low=returntext[returntext.index('<low>')+5:returntext.index('</low>')]
#print returntext2
# print returntext
return returntext2close,returntext2open,returntext2high,returntext2low,returntext2volume
def login():
payload = {'source':'XXXX','userid':'myloginname','password':'mypassword','version':'100'}
s=requests.session()
r = s.post("
https://apis.tdameritrade.com/apps/100/LogIn?source=XXXX&version=100",data=payload)
output = r.text
return s,output