urllib2 not support proxy on SSL connection?

2006-05-02 Thread itay_k
Hi,

I am running the following simple code (just open connection to some
https page with proxy):

proxy= '666.179.227.666:80'
proxy=urllib2.ProxyHandler({"https":'https://'+proxy})
opener = urllib2.build_opener(proxy)
request = urllib2.Request('https://somehttpspage')
response = opener.open(request)

And I get this error:
Traceback (most recent call last):
  File "", line 1, in ?
  File "C:\Python24\lib\urllib2.py", line 358, in open
response = self._open(req, data)
  File "C:\Python24\lib\urllib2.py", line 376, in _open
'_open', req)
  File "C:\Python24\lib\urllib2.py", line 337, in _call_chain
result = func(*args)
  File "C:\Python24\lib\urllib2.py", line 1029, in https_open
return self.do_open(httplib.HTTPSConnection, req)
  File "C:\Python24\lib\urllib2.py", line 996, in do_open
raise URLError(err)
urllib2.URLError: 

Is it possible that urllib2 doesnt support for proxy over https
connections?

Thanks alot,
Itay.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: send cookie on request with urllib2

2006-04-22 Thread itay_k
Thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: send cookie on request with urllib2

2006-04-21 Thread itay_k
ok.
i will explain what exactly i wanna do.

i want to simulate the following client-side script with python:




document.cookie="name=tom";
document.images["Pic"].src="temp2.html"


what that happen here, is when this page loading, the browser loads
"temp2.html" with HTTP header:
Cookie: name=tom;

this cookie does not come for the server, this is temporary cookie that
sending from the client to the server.
this cookie doesnt save on disk at all.

is it possible to implements this at python??

-- 
http://mail.python.org/mailman/listinfo/python-list


send cookie on request with urllib2

2006-04-20 Thread itay_k
Hi,

I dont understand why this is so complicated, just to add one line of
cookie header on the GET request.

This is my unworking code:
import time
import Cookie
import cookielib, urllib2

c= cookielib.Cookie(1,"Name","Tom", 80,False, "itay", False, False,
"d:\\asddd",False, False,time.time()+1000,False,None,None,None)
cj = cookielib.CookieJar()
cj.set_cookie(c)
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.open(r'http://itay/temp.html";)

why this isn't working?
Itay is my computer name. it is an IIS server too.
the code is running, but i dont see any cookie that attached to the GET
request.

thanks alot!

-- 
http://mail.python.org/mailman/listinfo/python-list


http request with cookie sending

2006-04-18 Thread itay_k
Hi,

I want to send a cookie on some http request (with urllib2),
so I created a Cookie but I cant associate it with CookieJar object.

for example:

import Cookie
import cookielib, urllib2

C = Cookie.SimpleCookie()
C["a"] = "b"

cj = cookielib.CookieJar()
cj.set_cookie(C)

in the last line I got:
Traceback (most recent call last):
  File "", line 1, in ?
  File "C:\Python24\lib\cookielib.py", line 1593, in set_cookie
if cookie.domain not in c: c[cookie.domain] = {}
AttributeError: 'SimpleCookie' object has no attribute 'domain'

why?
maybe.. there is any code example for sending cookie with some http
request operation?

thanks alot,
Itay.

-- 
http://mail.python.org/mailman/listinfo/python-list