urlopen differences between python 2.3.3 and python 2.2???

Discussion in 'Python' started by Chris, Apr 14, 2004.

  1. Chris

    Chris Guest

    I am using the code below and it works correctly on python2.2 but
    gives me a 404 not found error when running on python2.3.3. Is there
    some difference? Maybe python 2.3.3 is sending different headers?

    The params string looks to be encoded identically, so must be
    something with urlopen. Does anyone have any suggestions to get this
    working from python2.3.3??


    Thanks in advance!

    import httplib,urllib

    def signup(self, REQUEST):
    """
    Allows us to automatically sign-up a user.
    """
    email = REQUEST['Email']
    first_name = REQUEST['FirstName']
    last_name = REQUEST['LastName']
    if REQUEST.has_key('Company'):
    company = REQUEST['Company']
    else:
    company = ''

    if REQUEST.has_key('Address'):
    address = REQUEST['Address']
    else:
    address = ''

    if REQUEST.has_key('City'):
    city = REQUEST['City']
    else:
    city = ''

    if REQUEST.has_key('State'):
    state = REQUEST['State']
    else:
    state = ''

    if REQUEST.has_key('Zip'):
    zip = REQUEST['Zip']
    else:
    zip = ''

    if REQUEST.has_key('Phone'):
    phone = REQUEST['Phone']
    else:
    phone = ''

    if REQUEST.has_key('Fax'):
    fax = REQUEST['Fax']
    else:
    fax = ''

    params_list = {'owner_id_enc':'18164,$1$mGEJB$g1V9TwRwtIEsBj5XsnnN1/',
    'user_email':email,
    'user_email_fmt':'html',
    'user_fname':first_name,
    'user_lname':last_name,
    'user_company':company,
    'user_addr1':address,
    'user_city':city,
    'user_state':state,
    'user_state_other':'',
    'user_zip':zip,
    'user_phone':phone,
    'user_fax':fax,
    'user_attr1':'a',
    'function':'Subscribe'}
    params = urllib.urlencode(params_list)
    f = urllib.urlopen("http://mailermailer.com/x", params)
    return f.read()

    print signup(None,{'Email':'','FirstName':'Chris','LastName':'Bruce'})
     
    Chris, Apr 14, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Xu, C.S.
    Replies:
    5
    Views:
    522
    John J. Lee
    Sep 17, 2003
  2. Chris
    Replies:
    0
    Views:
    1,115
    Chris
    Jul 10, 2005
  3. cjl
    Replies:
    5
    Views:
    533
    John Nagle
    Mar 20, 2007
  4. Home_Job_opportunity
    Replies:
    0
    Views:
    528
    Home_Job_opportunity
    Jan 8, 2009
  5. Home_Job_opportunity
    Replies:
    0
    Views:
    617
    Home_Job_opportunity
    Jan 14, 2009
Loading...

Share This Page