A simple py script
import urllib2
req=urllib2.Req uest("http://www.google.com" )
req.set_proxy(" 127.0.0.1:1","h ttp")
print urllib2.urlopen (req).read()
Here is error:
"C:\Python25\py thon.exe" -u "E:\Python\Craw ler\test.py"
Traceback (most recent call last):
File "E:\Python\Craw ler\test.py", line 4, in <module>
print urllib2.urlopen (req).read()
File "C:\Python25\li b\urllib2.py", line 121, in urlopen
return _opener.open(ur l, data)
File "C:\Python25\li b\urllib2.py", line 374, in open
response = self._open(req, data)
File "C:\Python25\li b\urllib2.py", line 392, in _open
'_open', req)
File "C:\Python25\li b\urllib2.py", line 353, in _call_chain
result = func(*args)
File "C:\Python25\li b\urllib2.py", line 1101, in http_open
return self.do_open(ht tplib.HTTPConne ction, req)
File "C:\Python25\li b\urllib2.py", line 1076, in do_open
raise URLError(err)
urllib2.URLErro r: <urlopen error (10054, 'Connection reset by peer')>
I built a proxy with CCproxy 6.3.2 on my own machine, and it's working
absolutely all right, but how can my simple python script go wrong ? 1 4840
* est <el***********@ gmail.com[2007-07-23 09:50:17]:
A simple py script
import urllib2
req=urllib2.Req uest("http://www.google.com" )
req.set_proxy(" 127.0.0.1:1","h ttp")
print urllib2.urlopen (req).read()
Try to use the ProxyHandler of urllib2.
import urllib2
proxy_url = 'http://' + PROXY_USER + ':' + PROXY_PASSWORD + \ '@' + PROXY_IP + ':' + PROXY_PORT
proxy_support = urllib2.ProxyHa ndler({'http': proxy_url})
opener = urllib2.build_o pener(proxy_sup port, urllib2.HTTPHan dler)
urllib2.install _opener(opener)
print urllib2.urlopen (req).read()
urllib2.URLErro r: <urlopen error (10054, 'Connection reset by peer')>
The error indicates a network issue. Please see the difference when you use
the ProxyHandler to try it.
--
O.R.Senthil Kumaran http://uthcode.sarovar.org This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dont bother |
last post by:
This is really driving me crazy.
I have a dictionary feature_vectors{}. I try to sort
its keys using
#apply sorting on feature_vectors
sorted_feature_vector=feature_vectors.keys()
sorted_feature_vector.sort()
#feature_vector.keys()=sorted_feature_vector
|
by: John F Dutcher |
last post by:
Can anyone comment on why the code shown in the Python error is in
some way incorrect...or is there a problem with Python on my hoster's
site ??
The highlites don't seem to show here...but line #80 and line # 38 are
the first line offenders.
--> --> -->
|
by: Shapper |
last post by:
Hello,
I have this code in Global.asax:
Sub Session_Start(Sender As Object, E As EventArgs)
Dim cookie As HttpCookie = Request.Cookies("MyCookie")
If Not cookie Is Nothing Then
Response.Write(" * Cookie Exists * ")
If Not cookie.Values("culture") Is Nothing
|
by: Miguel Dias Moura |
last post by:
Hello,
I have been trying, for days, to retrieve a control's ClientId in a
javascript function.
I am using a master page and this is why I need to retrieve the
Control's ClientId.
The control Id is "Panel1". I placed "<%=Panel1.ClientID %>" in my HTML
code and I got "ctl00_pPanel1".
In my Javascript function I am using:
|
by: Pupeno |
last post by:
Hello,
I am experiencing a weird behavior that is driving me crazy. I have module
called Sensors containing, among other things:
class Manager:
def getStatus(self):
print "getStatus(self=%s)" % self
return {"a": "b", "c": "d"}
and then I have another module called SensorSingleton that emulates the
| |
by: Alessandro Fachin |
last post by:
I write this simply code that should give me the access to private page with
htaccess using a proxy, i don't known because it's wrong...
import urllib,urllib2
#input url
url="http://localhost/private/file"
#proxy set up
|
by: rashpal.sidhu |
last post by:
Please help, this problem is driving me crazy !!
I am using metaphone to create phonetic keys. When i run the module
stand-a-lone it works fine.
I'm trying to create a runner for informix which includes the function
in order to allow me to call it from within a 4gl program. When i do
this i get differences in the key that is produced?????
This only happens when metahpone translates an x in a name. The stand
|
by: mark4asp |
last post by:
Every time the function below is called I get the alert. So I put a
deliberate error in there and I check the value of
(reportType=='MANDATE') in Firebug, which is found to be true. But
still the alert comes up. Why?
I checked the following watch expressions at the blah blah point.
id = 5843
reportType = "MANDATE"
|
by: kheitmann |
last post by:
OK, so I have a blog. I downloaded the "theme" from somewhere and have edited a few areas to suit my needs. There are different font themes within the page theme. Long story short, my "Text Posts" are supposed to be in the font: Georgia, but they are showing up in "Times New Roman"...blah!
I can't find anything wrong in the code, but who am I trying to fool? I know nothing about this stuff. The code is below. The parts that I *think*...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |