Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pycurl
- from StringIO import StringIO
- c = pycurl.Curl()
- url = 'https://site.ru/index.php'
- url1 = 'https://site.ru/index.php?_m=tickets&_a=manage&departmentid=17&ticketstatusid=1'
- c.setopt(pycurl.URL, url)
- c.setopt(pycurl.POSTFIELDS, 'username=user&password=pass&_ca=login')
- c.setopt(pycurl.COOKIEJAR, "/tmp/cookie.txt")
- c.setopt(pycurl.COOKIEFILE, "/tmp/cookie.txt")
- def __list(url) :
- c.setopt(pycurl.URL, url)
- c.setopt(pycurl.COOKIEJAR, "/tmp/cookie.txt")
- c.setopt(pycurl.COOKIEFILE, "/tmp/cookie.txt")
- c.bodyio = StringIO()
- c.setopt(pycurl.WRITEFUNCTION, c.bodyio.write)
- c.get_body = c.bodyio.getvalue
- c.perform()
- return c.get_body()
- print __list(url1)
Add Comment
Please, Sign In to add comment