How should I write a recipe to log into the following page:
https://membership.chosun.com/login/index_n.jsp
Is this right? I tried, but it doesn't seem to work.
Code:
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
if self.username is not None and self.password is not None:
cookies = mechanize.CookieJar()
br = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies))
request = urllib.urlencode([('USER', self.username), ('PASSWORD', self.password),])
response = br.open('https://membership.chosun.com/login/index_n.jsp', request)
return br
I've also tried the code below. Still not working. Articles that don't require login download well. But premium articles that needs login are left out.
Code:
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
if self.username is not None and self.password is not None:
br.open('http://membership.chosun.com/login/index_n.jsp')
br.select_form(name='dizzologinform')
br['USER'] = self.username
br['PASSWORD'] = self.password
br.submit()
return br