Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed to create a persistence session in python using mechanize browser instance
    primarykey
    data
    text
    <pre><code>import mechanize import urllib2 import time import cookielib import requests username = 'user@gmail.com' # your username/email password = 'pwd' # your password br = mechanize.Browser() # browser settings (used to emulate a browser) br.set_handle_equiv(True) br.set_handle_redirect(True) br.set_handle_referer(True) br.set_handle_robots(False) br.set_debug_http(False) br.set_debug_responses(False) br.set_debug_redirects(False) br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time = 1) br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')] br.open('https://sso.openx.com/login/login') # open twitter br.select_form(nr=0) # select the form br['email'] = username br['password'] = password br.submit() # submit the login data # set cookies cookies = cookielib.LWPCookieJar() br.set_cookiejar(cookies) print cookies temp_jar=br.set_cookiejar(cookies) print(br.response().read()) # print the response br1=mechanize.Browser() br1.set_cookiejar(cookies) br1.set_handle_robots(False) r=br1.open('http://ox-ui.admin.one97adworks.com/ox/3.0/a/report/run?&amp;report_format=json&amp;end_date=2013-06-01&amp;report=order_perf&amp;do_break=&amp;rollup=hourly&amp;start_date=2013-06-01') print r.text </code></pre> <p>basically i have 2 URL's I have to login in first("<a href="https://sso.openx.com/login/login" rel="nofollow">https://sso.openx.com/login/login</a>") only after logging in with correct credentials i will have access to the other url ("<a href="http://ox-ui.admin.one97adworks.com/ox/3.0/a/report/run?&amp;report_format=json&amp;end_date=2013-06-01&amp;report=order_perf&amp;do_break=&amp;rollup=hourly&amp;start_date=2013-06-01" rel="nofollow">http://ox-ui.admin.one97adworks.com/ox/3.0/a/report/run?&amp;report_format=json&amp;end_date=2013-06-01&amp;report=order_perf&amp;do_break=&amp;rollup=hourly&amp;start_date=2013-06-01</a>") and i have to fetch the json returned by the URL</p> <p>So basically i want a persistent session with which i can login and then access the other url i am able to login successfully but haven't been able to call the other url using the same session or cookies or any other persistence method between the two calls</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload