Найти - Пользователи
Полная версия: <urlopen error no host given>
Начало » Python для новичков » <urlopen error no host given>
1
denis.ka
Всем доброго времени суток! Есть такой код

def RetPr( self,myurl, proxy):
urllib2.install_opener(
urllib2.build_opener(
urllib2.ProxyHandler({'http': proxy})
)
)
url = "http://toolbarqueries.google.es/search?features=Rank&sourceid=navclient-ff&client=navclient-auto-ff&googleip=O;%s&iqrn=8VdB&querytime=4P&orig=0X557&swwk=-1&ch=%s&q=info:%s“ %(proxy,self.getCh(myurl),urllib.quote_plus(myurl))
try:
f = urllib2.urlopen(url)
response = f.read()
print response
f.close()
res = response.split(”:")
try:
pr = res
if pr:
return pr
else:
return False
except:
return False
except urllib2.URLError, e:
print e
return False

код принимает ссылку и прокси для того что бы вернуть данные но возвращает на сервере urlopen error no host given, вопрос что делаю не так??? так как на локальной машине результат приходит, может ли быть такое что не передается прокси??? Всем спасибо за любую информацию
mcnet
http://docs.python.org/library/urllib2.html
Здесь не смотрели примеры? В самом низу страницы.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB