In previous post i created a server-client pair using the python.
It is enhanced in such a way that client will pass a download link
to server and server will download the link.
import sys
import socket
sys.path.append('/home/subhash/subh/python/requests')
import requests
s=socket.socket()
hostname=socket.gethostname()
port=9595
s.bind((hostname,port))
s.listen(5)
while True:
print 'server started'
conn,addr=s.accept()
data=conn.recv(1024)
print(data)
r=requests.get(data)
with open('downloded.pdf',"wb") as code:
code.write(r.content);
print 'page downloaded'
conn.close()
s.close()
you can see the code in git. :) B-)
It is enhanced in such a way that client will pass a download link
to server and server will download the link.
import sys
import socket
sys.path.append('/home/subhash/subh/python/requests')
import requests
s=socket.socket()
hostname=socket.gethostname()
port=9595
s.bind((hostname,port))
s.listen(5)
while True:
print 'server started'
conn,addr=s.accept()
data=conn.recv(1024)
print(data)
r=requests.get(data)
with open('downloded.pdf',"wb") as code:
code.write(r.content);
print 'page downloaded'
conn.close()
s.close()
you can see the code in git. :) B-)
No comments:
Post a Comment