Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!xlned.com!feeder5.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'url:sourceforge': 0.03; 'urllib2': 0.07; 'python': 0.09; 'cookies': 0.09; 'steve': 0.13; 'url:)': 0.13; 'library': 0.15; '24,': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'mechanize': 0.16; 'subject:Logging': 0.16; 'url:mechanize': 0.16; 'url:techchorus': 0.16; 'url:wwwsearch': 0.16; 'wrote:': 0.17; 'tim': 0.18; 'requests': 0.18; 'module': 0.19; 'thanks.': 0.21; 'this:': 0.23; "i've": 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'besides': 0.27; 'library.': 0.27; 'post': 0.28; 'credentials': 0.29; 'thursday,': 0.30; 'code': 0.31; 'docs': 0.33; 'to:addr:python-list': 0.33; 'done': 0.34; 'requiring': 0.35; 'similar': 0.35; 'something': 0.35; 'received:org': 0.36; 'message-id:@gmail.com': 0.36; 'anything': 0.36; 'subject:: ': 0.38; 'login': 0.38; 'gives': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'subject:Need': 0.61; 'subject:For': 0.75; 'subject:Website': 0.75; 'article': 0.78; '2013': 0.84; 'start.': 0.84; 'luck': 0.93; 'technique': 0.93 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Fri, 25 Jan 2013 12:18:11 -0700 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.11) Gecko/20121115 Thunderbird/10.0.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Need Pattern For Logging Into A Website References: <3f55e471-8657-4cad-96cd-96e9e2e01a9d@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1359142676 news.xs4all.nl 6896 [2001:888:2000:d::a6]:33579 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37689 On 01/25/2013 09:18 AM, Tim Daneliuk wrote: > On 01/25/2013 10:01 AM, Steve Petrie wrote: >> On Thursday, January 24, 2013 8:29:51 PM UTC-5, Tim Daneliuk >> wrote: The mechanize module >> (http://wwwsearch.sourceforge.net/mechanize/) might be a place to >> start. I've done something similar with code like this: > Thanks. I've had good luck using urllib2 and a cookiejar. Just post your login credentials against the login url, keep all the cookies and then make your other requests using that cookiejar. Besides the Python standard library docs on urllib2 and cookielib, here's an article that gives an overview of how to use it: http://www.techchorus.net/using-cookie-jar-urllib2 This technique has the advantage of not requiring anything outside of the standard library.