473,383 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Client side network programming

I am interested in making a search engine which takes web sites
iteratively, and downloads the web page or has to perform some search
across the web pages.
I am unsucessful to do so. My machine works through a proxy server and the
internet connection is through 24 hour lease line. when ever i try the
code it gives :

Traceback (innermost last):
File "http-getfile-urllib2.py", line 19, in ?
urllib.urlretrieve(remoteaddr, localname)
File "/usr/lib/python1.5/urllib.py", line 66, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook)
File "/usr/lib/python1.5/urllib.py", line 186, in retrieve
fp = self.open(url)
File "/usr/lib/python1.5/urllib.py", line 159, in open
return getattr(self, name)(url)
File "/usr/lib/python1.5/urllib.py", line 260, in open_http
h = httplib.HTTP(host)
File "/usr/lib/python1.5/httplib.py", line 53, in __init__
if host: self.connect(host, port)
File "/usr/lib/python1.5/httplib.py", line 81, in connect
self.sock.connect(host, port)
IOError: [Errno socket error] (101, 'Network is unreachable')
================================================== ==========
The code is like this:-
#!/usr/bin/env python
import os, sys, urllib, urlparse, socket
showlines = 6
try:
servername, filename = sys.argv[1:3]
except:
servername, filename = 'www.igib.res.in', '/sarsanalysis.html'

remoteaddr = 'http://%s%s' % (servername, filename)
if len(sys.argv) == 4:
localname = sys.argv[3]
else:
(scheme, server, path, parms, query, frag) =
urlparse.urlparse(remoteaddr)
localname = os.path.split(path)[1]

print remoteaddr, localname
urllib.urlretrieve(remoteaddr, localname)
remotedata = open(localname).readlines()
for line in remotedata[:showlines]: print line,
================================================== ==========
I am new to the internet programming as well as python. please guide me,
how to solve this one.

Jul 18 '05 #1
2 3180
On Wed, 02 Jun 2004 06:23:20 -0400, "Roysun_rohit"
<ro**********@rediffmail.com> wrote:
I am interested in making a search engine which takes web sites
iteratively, and downloads the web page or has to perform some search
across the web pages.
I am unsucessful to do so. My machine works through a proxy server and the
internet connection is through 24 hour lease line. when ever i try the
code it gives :

Traceback (innermost last):
File "http-getfile-urllib2.py", line 19, in ?
urllib.urlretrieve(remoteaddr, localname)
File "/usr/lib/python1.5/urllib.py", line 66, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook)
File "/usr/lib/python1.5/urllib.py", line 186, in retrieve
fp = self.open(url)
File "/usr/lib/python1.5/urllib.py", line 159, in open
return getattr(self, name)(url)
File "/usr/lib/python1.5/urllib.py", line 260, in open_http
h = httplib.HTTP(host)
File "/usr/lib/python1.5/httplib.py", line 53, in __init__
if host: self.connect(host, port)
File "/usr/lib/python1.5/httplib.py", line 81, in connect
self.sock.connect(host, port)
IOError: [Errno socket error] (101, 'Network is unreachable')
================================================= ===========
The code is like this:-
#!/usr/bin/env python
import os, sys, urllib, urlparse, socket
showlines = 6
try:
servername, filename = sys.argv[1:3]
except:
servername, filename = 'www.igib.res.in', '/sarsanalysis.html'

remoteaddr = 'http://%s%s' % (servername, filename)
if len(sys.argv) == 4:
localname = sys.argv[3]
else:
(scheme, server, path, parms, query, frag) =
urlparse.urlparse(remoteaddr)
localname = os.path.split(path)[1]

print remoteaddr, localname
urllib.urlretrieve(remoteaddr, localname)
remotedata = open(localname).readlines()
for line in remotedata[:showlines]: print line,
================================================= ===========
I am new to the internet programming as well as python. please guide me,
how to solve this one.
urllib will work with proxies. Just set your environment to point at
it before you start python. Like this (copied from the urllib doc):

% http_proxy="http://www.someproxy.com:3128"
% export http_proxy
% python

hth,<{{{*>


Jul 18 '05 #2
Try downloading HarvestMan from http://harvestman.freezope.org .

-Anand
fishboy <fi*****@spamspamspam.com> wrote in message news:<qs********************************@4ax.com>. ..
On Wed, 02 Jun 2004 06:23:20 -0400, "Roysun_rohit"
<ro**********@rediffmail.com> wrote:
I am interested in making a search engine which takes web sites
iteratively, and downloads the web page or has to perform some search
across the web pages.
I am unsucessful to do so. My machine works through a proxy server and the
internet connection is through 24 hour lease line. when ever i try the
code it gives :

Traceback (innermost last):
File "http-getfile-urllib2.py", line 19, in ?
urllib.urlretrieve(remoteaddr, localname)
File "/usr/lib/python1.5/urllib.py", line 66, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook)
File "/usr/lib/python1.5/urllib.py", line 186, in retrieve
fp = self.open(url)
File "/usr/lib/python1.5/urllib.py", line 159, in open
return getattr(self, name)(url)
File "/usr/lib/python1.5/urllib.py", line 260, in open_http
h = httplib.HTTP(host)
File "/usr/lib/python1.5/httplib.py", line 53, in __init__
if host: self.connect(host, port)
File "/usr/lib/python1.5/httplib.py", line 81, in connect
self.sock.connect(host, port)
IOError: [Errno socket error] (101, 'Network is unreachable')
================================================= ===========
The code is like this:-
#!/usr/bin/env python
import os, sys, urllib, urlparse, socket
showlines = 6
try:
servername, filename = sys.argv[1:3]
except:
servername, filename = 'www.igib.res.in', '/sarsanalysis.html'

remoteaddr = 'http://%s%s' % (servername, filename)
if len(sys.argv) == 4:
localname = sys.argv[3]
else:
(scheme, server, path, parms, query, frag) =
urlparse.urlparse(remoteaddr)
localname = os.path.split(path)[1]

print remoteaddr, localname
urllib.urlretrieve(remoteaddr, localname)
remotedata = open(localname).readlines()
for line in remotedata[:showlines]: print line,
================================================= ===========
I am new to the internet programming as well as python. please guide me,
how to solve this one.


urllib will work with proxies. Just set your environment to point at
it before you start python. Like this (copied from the urllib doc):

% http_proxy="http://www.someproxy.com:3128"
% export http_proxy
% python

hth,
<{{{*>

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jim | last post by:
I having a difficult time here trying to figure out what to do here. I need a way to scroll through a recordset and display the results with both forward and backward movement on a web page(PHP...
4
by: Support | last post by:
Hello: I wrote a vb6 "client-side" ActiveX Component that will extract the user's network login. Now I want to be able to do some server-side work with this info, and it would be great if I could...
2
by: Dicky Cheng | last post by:
Hi, I am using .net remoting technology. I set up a .net remoting client and server in IIS. When the client calls the server, the server will run a long duration method (30-60seconds). I have a...
11
by: Timothy Shih | last post by:
Hi, I am having a freezing issue with my application. My application serves several remotable objects, all of which must be initialized before their use. Furthermore, some of them depend on each...
1
by: Matthew Louden | last post by:
Personally, I am totally confused with the following control terms and usage and advantages of each one in ASP.NET web application. Here's what I know so far.. 1. HTML Client Control: understood...
2
by: Ivan Samuelson | last post by:
Does anyone know of a book that covers client-side programming in ASP.NET? I have no problem programming on the server-side, but I'm at a loss on the client-side, including how to program either in...
1
by: Mike Dole | last post by:
I'm sorry to bother you with this question but it was either this or giving up and trying to go for a simpler solution (which I will if this is not gonna work out..) I'm afraid this is way out...
1
by: Ryman | last post by:
Hello, I've just recently began network programming for c# (bought the book C# Network Programming) and I've ran into a few problems. Whenever I click the submit button on the client (to send the UDP...
3
by: Ryan Liu | last post by:
Hi, I use Server: Use an endless thread to lisiten to clients requests: while(true) { TcpClient client = myListener.AcceptTcpClient();
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.