User Profile

Collapse

Profile Sidebar

Collapse
trihaitran
trihaitran
Last Activity: Jul 1 '09, 11:29 PM
Joined: Feb 20 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • trihaitran
    started a topic Problem installing Pylons on OS X

    Problem installing Pylons on OS X

    I am reading chapter two of the Pylons book. In the text I am told to run:

    Code:
    $ python virtualenv.py --no-site-packages env
    This is what I got back:

    Code:
    $ python virtualenv.py --no-site-packages env
    New python executable in env/bin/python
    Installing setuptools...........
      Complete output from command env/bin/python -c "#!python
    \"\"\"Bootstrap setuptoo...
    ...
    See more | Go to post

  • trihaitran
    started a topic Need help translating Ruby code
    in Ruby

    Need help translating Ruby code

    Hi I am new to Ruby from Python and am still learning some stuff. I
    have a Ruby program that uses the mechanize library to connect to a Web
    site and authenticate with a username and password. The issue I have is
    that I need to get this code translated into Python. The Python
    mechanize library is not very well documented and I was wondering if
    anyone here had any experience using this library in Ruby or Python.
    ...
    See more | Go to post

  • trihaitran
    started a topic Using mechanize to do website authentication

    Using mechanize to do website authentication

    I am trying to write a web scraper and am having trouble accessing pages that require authentication. I am attempting to utilise the mechanize library, but am having difficulties. The site I am trying to login is http://www.princetonre view.com/Login3.aspx?uid badge=

    user: bugmenot2008@ya hoo.com
    pass: letmeinalready

    Previously I did something similar to another site: schoolfinder.co m. Here is my code for that:...
    See more | Go to post

  • trihaitran
    replied to Help with cookies/authentication
    Thanks for the help. Your code by itself did not work, but it pushed me in the right direction. Here is what worked for me and let me see the protected pages:

    Code:
    #!/usr/bin/env python
    # -*- coding: UTF-8 -*-
    
    import cookielib
    import urllib
    import urllib2
    
    cj = cookielib.CookieJar()
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
    resp = opener.open('http://schoolfinder.com')
    ...
    See more | Go to post

    Leave a comment:


  • trihaitran
    started a topic Help with cookies/authentication

    Help with cookies/authentication

    Hi I am trying to pull some data from a Web site: http://schoolfinder.com

    The issue is that I want to use the advanced search feature which requires logging into the Web site. I have a username and password, however I want to connect programmaticall y from Python. I have done data capture from the Web before so the only new thing here to me is the authentication stuff. I need cookies as this page describes: http://schoolfinder.com/...
    See more | Go to post

  • trihaitran
    started a topic calling a function without changing scope

    calling a function without changing scope

    Hi,

    My problem is that I have a large function with hundreds of lines. I want to break it apart into smaller functions. The issue is that if I make a module level function, the scope changes and I have to pass the necessary variables to it. This can be difficult if there are 10 variables that need to be passed. So basically I want to be able to call a function inside another function but keep the scope the same. I found a way to do...
    See more | Go to post

  • trihaitran
    started a topic repetitive functions

    repetitive functions

    Hi,

    I've got about 10 functions that all share a bit of code. They all look something like this:

    [code=python]
    def func(arg):
    statement1
    statement2
    statement3

    unique code

    statement4
    statement5
    [/code]

    Each function does similar statements at the beginning and end, but has unique stuff in the middle. Is there a way for me to...
    See more | Go to post
No activity results to display
Show More
Working...