c = pycurl.Curl()
c.setopt(c.URL, host_url)
c.setopt(pycurl.TIMEOUT, 10)
c.setopt(pycurl.FOLLOWLOCATION, 1)
c.setopt(pycurl.POSTFIELDS,
    'j_username={ngnms_user}&j_password={ngnms_password}'.format(**self.
    ngnms_login))
c.setopt(pycurl.COOKIEJAR, 'data/ngnms.cookie')
c.setopt(pycurl.SSL_VERIFYPEER, 0)
session = c
return session
Logging in and using cookies in pycurl