snippsat's method works.
This will get you a list of packages.
if you take each entry in that list you can get additional information
1. get a list of releases with releases = self.client.package_releases(item)
2. get package URL with release_urls(package_name, version) - Actually gets a lot more including MD5, python version, etc.
3. From the release list, get detailed information on that release with:
a. release_data(package_name, version)
4. You can also get change log info and more
see:
https://wiki.python.org/moin/PyPIXmlRpc?...PyPiXmlRpc
Sounds like something (with a GUI wrapper) that should go on the Code Idea list
Here's Snippsat's code modified to get additional information
import json
import HasInternet
try:
import xmlrpclib
except ImportError:
import xmlrpc.client as xmlrpclib
from collections import defaultdict
import time
class GetPyPi:
def __init__(self):
self.use_pkg_file = False
self.packages = defaultdict(lambda: defaultdict(list))
self.pkg_filename = 'packages.json'
self.json_name = None
self.web_available = False
if HasInternet.has_connection():
self.web_available = True
if self.web_available:
self.client = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')
def try_package_release(self):
if self.web_available:
allpackages = None
print('updating package list')
if self.use_pkg_file:
with open(self.pkg_filename, 'r') as f:
j = f.read()
allpackages = json.loads(j)
else:
allpackages = self.client.list_packages()
allpackages.sort()
with open(self.pkg_filename, 'w') as f:
j = json.dumps(allpackages)
f.write(j)
for n, item in enumerate(allpackages):
print('Fetching release data for: {}'.format(item))
releases = self.client.package_releases(item)
for release in releases:
time.sleep(.2)
release_data = self.client.release_data(item, release)
print('release_data: {}'.format(release_data))
else:
print('Please check internet connection')
if __name__ == '__main__':
gpp = GetPyPi()
gpp.try_package_release()
You also need the HasInternet.py module:
import subprocess
def has_connection():
website = "google.com"
ping = subprocess.Popen(["ping", website], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, error = ping.communicate()
if 'Sent = 4, Received = 4' in out.decode('utf-8'):
return True
return False
if __name__ == '__main__':
print(has_connection())