how to use httplib.HTTPConnection with http proxy? 4 11706
JuHui wrote: how to use httplib.HTTPConnection with http proxy?
simply connect to the proxy? - and ask using the full url and original
Host: - for HTTPS do a CONNECT <host>.
Robert
sorry, would you please give a sample code?
I want to use HTTPConnection to get a html page content via a http
proxy.
thanks.
>>> import httplib h = httplib.HTTPConnection("www.google.ca") h.connect()
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python24\lib\httplib.py", line 627, in connect
raise socket.error, msg
error: (10061, 'Connection refused') h2 = httplib.HTTPConnection("my.proxy.host", "my.proxy.port") h2.connect() h2.request("GET", "http://www.google.ca") resp = h2.getresponse() page = resp.read()
JuHui wrote: sorry, would you please give a sample code? I want to use HTTPConnection to get a html page content via a http proxy. thanks.
-> adam
and maybe you just want plain GET/POST. use urllib url='http://www.google.ca' urllib.FancyURLopener(proxies={'http':'http://vs:3128'}).open( url
).read()
'<html><head><meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1"><title>Google</title><style><!--\nbody,td,a,p,.h{font-family:arial,sans-serif;}\n.h{font-size:
20px....
Robert This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: scummer |
last post by:
Hi,
I am having a problem with the httplib HTTPConnection object. While I
can easily send requests that don't have any payload (ie. "get"), I
encounter issues if I want to post xml data. If you...
|
by: Laszlo Zsolt Nagy |
last post by:
Hello,
This is from the docs, from section 11.6.1 (HTTPConnection Objects)
HTTPConnection instances have the following methods:
request( method, url])
The headers argument should be a...
|
by: spamsink42 |
last post by:
this code
h=httplib.HTTPConnection('euronext.com')
h.request('GET',
'http://www.euronext.com/home/0,3766,1732,00.html')
fails with this message
File "httplib.py", line 532, in connect...
|
by: JuHui |
last post by:
how to use httplib.HTTPConnection with http proxy?
|
by: scott |
last post by:
Hello,
From a shell script, I have used /usr/bin/curl to access a web site
and pass a cookie (as required by the site). But, I can't seem to
accomplish this task with Python. I would like to...
|
by: Mark rainess |
last post by:
The program displays images from a motion jpeg webcam.
(Motion jpeg is a bastardization of multi-part mime.)
<http://wp.netscape.com/assist/net_sites/pushpull.html>
It runs perfectly for about 4...
|
by: Dustin J. Mitchell |
last post by:
I'm building an interface to Amazon's S3, using httplib. It uses a
single object for multiple transactions. What's happening is this:
HTTP PUT /unitest-temp-1161039691 HTTP/1.1
HTTP Date: Mon,...
|
by: Phoe6 |
last post by:
Hi,
The following piece of code works properly when my proxy password
contains characters etc. But when my proxy password
contained something like '|\/|' , the httplib incorrectly indentified
it...
|
by: rhXX |
last post by:
hi all,
i'm using this tutorial example
import httplib
h = httplib.HTTP("www.python.org")
h.putrequest('GET','/index.html')
h.putheader('User-Agent','Lame Tutorial Code')...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |