import urllib
response = urllib.urlopen('http://pool.sks-keyservers.net/')
print 'RESPONSE:', response
print 'URL :', response.geturl()
headers = response.info()
print 'DATE :', headers['date']
print 'HEADERS :'
print '---------'
print headers
data = response.read()
print 'LENGTH :', len(data)
print 'DATA :'
print '---------'
print data
This code enable me to see some webpage information and contents. what actually i had query that how to fetch the public key from any public key server using python function.
Use http://pypi.python.org/pypi/python-hkp
Python HPK client.
Usage example:
This spec should help you along, and stop you asking the same question repeatedly :). Basically you need to perform an HTTP GET request to the key server. Most key servers work on TCP port 11371 so you need to ensure that your firewall will let you through.
For example, this URL will give you God's public key:
http://pool.sks-keyservers.net:11371/pks/lookup?op=get&search=0x1278A1862492D908&options=mr
The response is the key.
In python: