I'm trying to login using POST method,please help.
import urllib2, cookielib
cookie_support= urllib2.HTTPCookieProcessor(cookielib.CookieJar())
opener = urllib2.build_opener(cookie_support, urllib2.HTTPHandler)
urllib2.install_opener(opener)
content = urllib2.urlopen("https://indivinet.ca/api/v1/login",api_key=5f1d5cb35ca1953ecd8f63ac0ac44d3b&location_id=location&username=username&password=password).read()
It just says invalid syntax.
Please somebody correct the syntax.
You need to make your data value a string; it's not a python expression:
content = urllib2.urlopen(
"https://indivinet.ca/api/v1/login",
"api_key=5f1d5cb35ca1953ecd8f63ac0ac44d3b&location_id=location&username=username&password=password"
).read()