user2011532 user2011532 - 1 year ago 102
Python Question

Python POST login request

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)
content = urllib2.urlopen("",api_key=5f1d5cb35ca1953ecd8f63ac0ac44d3b&location_id=location&username=username&password=password).read()

It just says invalid syntax.

Please somebody correct the syntax.

Answer Source

You need to make your data value a string; it's not a python expression:

content = urllib2.urlopen(
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download