<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
sorry for the monolog .. :D<br>
<br>
<br>
i'm closed to succeed but how to retrieve transparently user and pwd ?<br>
<br>
import win32inet <br>
hinternet = win32inet.InternetOpen("foo 1.0", 0, "", "", 0)<br>
h =
win32inet.InternetOpenUrl(hinternet,'<a class="moz-txt-link-freetext" href="http://downloads.sourceforge.net/sevenzip/7z465.msi">http://downloads.sourceforge.net/sevenzip/7z465.msi</a>')<br>
win32inet.InternetSetOption(h,43,user)<br>
win32inet.InternetSetOption(h, 44,pwd)<br>
<br>
chunks = []<br>
while 1:<br>
chunk = win32inet.InternetReadFile(h, 1024)<br>
if not chunk:<br>
break<br>
chunks.append(chunk)<br>
data = ''.join(chunks)<br>
f = open('test.msi', 'wb')<br>
f.write(data)<br>
<br>
<br>
maybe should I use ctype like here :
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/1078939/id-like-to-call-the-windows-c-function-winhttpgetproxyforurl-from-python-can">http://stackoverflow.com/questions/1078939/id-like-to-call-the-windows-c-function-winhttpgetproxyforurl-from-python-can</a><br>
<br>
<br>
thanks for reading<br>
<br>
<br>
<br>
Le 01/03/2010 18:59, Christophe Deze a écrit :
<blockquote cite="mid:4B8C0078.7060007@wanadoo.fr" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
it should look like that ???<br>
<br>
import win32inet<br>
hinternet = win32inet.InternetOpen("foo 1.0", 0, "", "", 0)<br>
win32inet.InternetSetOption(INTERNET_OPTION_PROXY_PASSWORD,SizeofOtion)<br>
win32inet.InternetSetOption(INTERNET_OPTION_PROXY_USERNAME,SizeofOtion)<br>
#h = win32inet.InternetConnect(hinternet,'<a moz-do-not-send="true"
class="moz-txt-link-abbreviated"
href="http://www.google.fr%27,80,%27%27,%27%27,3,0">www.google.fr',80,'','',3,0</a>)<br>
<br>
h =
win32inet.InternetOpenUrl(hinternet,'<a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://downloads.sourceforge.net/sevenzip/7z465.msi">http://downloads.sourceforge.net/sevenzip/7z465.msi</a>')<br>
<br>
data =win32inet.InternetReadFile(hinternet,sizeOfFile)<br>
<br>
<br>
Le 01/03/2010 18:03, Christophe Deze a écrit :
<blockquote cite="mid:4B8BF35E.1030500@wanadoo.fr" type="cite">
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
<div class="moz-text-flowed"
style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">hello<br>
<br>
I wrote a windows app that must download file<br>
it works fine with <span class="pln">urllib</span><span class="pun">.</span><span
class="pln">urlretrieve.<br>
<br>
But I want to download file through a proxy</span><span class="pun"></span>
with
NTLM
(samba)authentication .<br>
I want to use windows sessions credential transparently, as IE and
Firefox do well...<br>
<br>
I don't think that urllib(2) can do this.<br>
<br>
But maybe a win32 API ?<br>
<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://docs.activestate.com/activepython/2.5/pywin32/win32inet.html">http://docs.activestate.com/activepython/2.5/pywin32/win32inet.html</a>
<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://msdn.microsoft.com/en-us/library/aa384220%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/aa384220%28VS.85%29.aspx</a>
<br>
<br>
<br>
What do you think of this ?<br>
any idea ?<br>
<br>
thanks<br>
<div class="moz-txt-sig"><span class="moz-txt-tag"><br>
<br>
<br>
<br>
</span></div>
</div>
<pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
python-win32 mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:python-win32@python.org">python-win32@python.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://mail.python.org/mailman/listinfo/python-win32">http://mail.python.org/mailman/listinfo/python-win32</a>
</pre>
</blockquote>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
python-win32 mailing list
<a class="moz-txt-link-abbreviated" href="mailto:python-win32@python.org">python-win32@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/python-win32">http://mail.python.org/mailman/listinfo/python-win32</a>
</pre>
</blockquote>
<br>
</body>
</html>