Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Help Tracing urllib2 Error, Please?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Larry Hale  
View profile  
 More options Jul 19 2008, 7:08 pm
Newsgroups: comp.lang.python
From: Larry Hale <larz...@hotmail.com>
Date: Sat, 19 Jul 2008 16:08:27 -0700 (PDT)
Local: Sat, Jul 19 2008 7:08 pm
Subject: Help Tracing urllib2 Error, Please?
Since it seems I have a "unique" problem, I wonder if anyone could
point me in the general/right direction for tracking down the issue
and resolving it myself.

See my prior post @ http://groups.google.com/group/comp.lang.python/browse_thread/thread/...
for more info.  (Python 2.5.2 on Win XP 64 ==>> Squid Proxy requiring
Authentication ==>> Internet not working.)

I've looked the urllib2 source over, but am having trouble following
it.  As previously mentioned, urllib2 initiates the request, Squid
replies "407 error" that auth's required, and then urllib2 just stops,
throwing error 407.

Any though(s) on what to check out?

It's frustrating (to say the least) that it seems so many are
successfully accomplishing this task, and all's working perfectly for
them, but I'm failing miserably.

Would any quotes viewed in the HTTP traffic help?  (Wireshark shows
all!  :)  I don't even know what other info could help.

Any info to get about Squid's configuration that might make it "non
standard" in a way that could cause my problem?  Any question(s) I
should ask my Net Admin to relay info to you all?

As always, any/all help greatly appreciated.  Thanks!  :)

-Larry


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rob Wolfe  
View profile  
 More options Jul 20 2008, 7:30 am
Newsgroups: comp.lang.python
From: Rob Wolfe <r...@smsnet.pl>
Date: Sun, 20 Jul 2008 13:30:09 +0200
Local: Sun, Jul 20 2008 7:30 am
Subject: Re: Help Tracing urllib2 Error, Please?

Maybe Squid is configured to not allow sending authentication
directly in URI. Or maybe there is only digest scheme allowed.
Try this:

def getopener(proxy=None, digest=False):
    opener = urllib2.build_opener(urllib2.HTTPHandler)
    if proxy:
        passwd_mgr = urllib2.HTTPPasswordMgr()
        passwd_mgr.add_password(None, 'http://localhost:3128', 'user', 'password')

        if digest:
            proxy_support = urllib2.ProxyDigestAuthHandler(passwd_mgr)
        else:
            proxy_support = urllib2.ProxyBasicAuthHandler(passwd_mgr)
        opener.add_handler(proxy_support)
    return opener

def fetchurl(url, opener):
    f = opener.open(url)
    data = f.read()
    f.close()
    return data

print fetchurl('http://www.python.org', getopener('127.0.0.1:3128'))
print fetchurl('http://www.python.org', getopener('127.0.0.1:3128', digest=True))

HTH,
Rob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »