Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Why is ClientCookie/urllib2 using https?

Thread Tools

Why is ClientCookie/urllib2 using https?

Grant Edwards
Posts: n/a
In the program shown below, all of the connections to the
servers are using port 443 and https (TLS protocol) -- both the
initial connection to and subsequent
connections to

It works, and I don't mind that it's encrypting the sessions as
well as the login, but I'd like understand why the connections
to "" are being done using
TLS to port 443 instead of raw TCP to port 80 as is implied by
the http: in the URL.

FWIW, it's a program to delete quarantined viruse-laden
messages from the server run by the Postini mail-filtering
service. Viruses can only be deleted 10 at a time, and when
you've got 7000 of them, that's a hell of a lot of mouse
clicks. When they're coming in 200-300 an hour, automating the
deleting process was the only reasonable solution.

import re,sys
import ClientCookie
import urllib,urllib2

postData = urllib.urlencode({

req1 = urllib2.Request("",data=postData)
rsp1 = ClientCookie.urlopen(req1)

req2 = urllib2.Request("")
rsp2 = ClientCookie.urlopen(req2)

while 1:
data =

m ='<form name=virus .*</form>',data,re.M|re.S)
if not m:
print "no virus form found"
vdata =

m ='Message 1 - [0-9]+ of [0-9]+',vdata,re.M|re.S)
if not m:
print "did not find message count"

r = re.compile('<input type="checkbox" name="msgid" value="([^"]*)">',re.M|re.S)
m = r.findall(vdata)

if not m:
print "no virus msgids found"

postData = urllib.urlencode({'submit':'Remove','disp':'M','ac tion':'change_Msgs'})
for msgid in m:
postData += "&msgid="+msgid

req2 = urllib2.Request("",postData)
rsp2 = ClientCookie.urlopen(req2)


Grant Edwards grante Yow! He is the
him --
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Cisco 2611 and Cisco 1721 : Why , why , why ????? Cisco 10 05-01-2005 08:49 AM
Why, why, why??? =?Utf-8?B?VGltOjouLg==?= ASP .Net 6 01-27-2005 03:35 PM
Why Why Why You HAVE NO IDEA MCSE 31 04-24-2004 06:40 PM