how to use httplib.HTTPConnection with http proxy? 4 11775
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |