Differences between revisions 1 and 47 (spanning 46 versions)
Revision 1 as of 2005-08-08 06:21:31
Size: 2873
Editor: RichardJones
Comment:
Revision 47 as of 2017-04-12 00:40:48
Size: 5094
Editor: EWDurbin
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
PyPI's XML-RPC methods
----------------------
[[CheeseShopDev|PyPI]] APIs: [[PyPISimple|Simple]], [[PyPIJSON|JSON]], '''XMLRPC'''.
Line 4: Line 3:
This is an initial list of proposed methods for PyPI to support: = The XMLRPC interface for PyPI is considered legacy and should not be used. =
= Use the Simple and JSON APIs. =
== PyPI's XML-RPC methods ==
Example usage:
Line 6: Line 8:
package_releases(package_name):
     Returns list of release versions, as strings, e.g., ['0.1', '0.2b',
     '0.2'], in chronological order.
{{{
>>> try:
>>> import xmlrpclib
>>> except ImportError:
>>> import xmlrpc.client as xmlrpclib
>>> import pprint
>>> client = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')
>>> client.package_releases('roundup')
['1.4.10']
>>> pprint.pprint(client.release_urls('roundup', '1.4.10'))
[{'comment_text': '',
  'downloads': 3163,
  'filename': 'roundup-1.1.2.tar.gz',
  'has_sig': True,
  'md5_digest': '7c395da56412e263d7600fa7f0afa2e5',
  'packagetype': 'sdist',
  'python_version': 'source',
  'size': 876455,
  'upload_time': <DateTime '20060427T06:22:35' at 912fecc>,
  'url': 'http://pypi.python.org/packages/source/r/roundup/roundup-1.1.2.tar.gz'},
 {'comment_text': '',
  'downloads': 2067,
  'filename': 'roundup-1.1.2.win32.exe',
  'has_sig': True,
  'md5_digest': '983d565b0b87f83f1b6460e54554a845',
  'packagetype': 'bdist_wininst',
  'python_version': 'any',
  'size': 614270,
  'upload_time': <DateTime '20060427T06:26:04' at 912fdec>,
  'url': 'http://pypi.python.org/packages/any/r/roundup/roundup-1.1.2.win32.exe'}]
}}}
'''list_packages()'''
Line 10: Line 41:
package_stable_version(package_name):
     Returns packages.stable_version; the current stable version of the
     package. E.g., the string '0.3'
 . Retrieve a list of the package names registered with the package index. Returns a list of name strings.
Line 14: Line 43:
package_urls(package_name, version):
     A list of {'url': url, 'packagetype': packagetype}, like [{'url':
     'http://svn.pythonpaste.org/Paste/trunk', 'packagetype':
     'svn_trunk'}, {'url': 'http://pythonpaste.org/Paste-0.1.tar.gz',
     'packagetype': 'sdist'}]
'''package_releases(package_name, show_hidden=False)'''
Line 20: Line 45:
package_data(package_name, version):
     A dictionary that summarizes the releases table, plus
     release_classifiers. E.g.: { { {
 . Retrieve a list of the releases registered for the given package_name. Returns a list with all version strings if show_hidden is True or only the non-hidden ones otherwise.
Line 24: Line 47:
         {'name': 'OpenRelease',
          'version': '0.1.2',
          'author': 'Richard Harris',
          'author_email': 'goosequill@users.sourceforge.net',
          'maintainer': '',
          'maintainer_email': '',
          'homepage': 'http://open-release.sourceforge.net',
          'download_url':
'http://prdownloads.sourceforge.net/projects/open-release/OpenRelease-0.1.2.tar.gz',
          'description': """OpenRelease is a Python module which
automates the packaging, release and announcement of Open Source
software. The pack class creates packages, which are defined by packer
classes, manages versioning, and brings up your notes and changelog in
an editor. The release class uploads the package to SourceForge,
releases it through QRS, announces it on freshmeat and (if appropriate)
on pypi.""",
          'license': 'GNU General Public License',
          'platform': 'any',
          'classifiers': [
              'Development Status :: 4 - Beta',
              'Environment :: Console',
              'Intended Audience :: Developers',
              'License :: OSI Approved :: GNU General Public License (GPL)',
              'Natural Language :: English',
              'Operating System :: OS Independent',
              'Programming Language :: Python',
              'Topic :: Software Development'],
          'summary': '',
          'description_html': '',
          'keywords': '',
          }
'''package_roles(package_name)'''
Line 56: Line 49:
} } }  . Retrieve a list of users and their attributes roles for a given package_name. Role is either 'Maintainer' or 'Owner'.
Line 58: Line 51:
     All keys are required. None/NULL is translated to ''. Open
     issues: will emails be obscured? Is keywords turned into a list?
'''user_packages(user)'''
Line 61: Line 53:
search(field_specifiers, [operator='and']):
     field_specifiers is a dictionary of {fieldname: searchvalue}.
     Returns a list like [(name, version)] of matching non-hidden
     records. The search values are case-insensitive and match any
     substring. The second argument indicates if all the field
     specifiers are ANDed or ORed together. The value defaults to
     'and' and is case-insensitive.
 . Retrieve a list of [role_name, package_name] for a given username. Role is either 'Maintainer' or 'Owner'.

'''release_downloads(package_name, version)'''

 . Retrieve a list of files and download count for a given package and release version.

'''release_urls(package_name, version)'''

 . Retrieve a list of download URLs for the given package release. Returns a list of dicts with the following keys:
  * url
  * packagetype ('sdist', 'bdist', etc)
  * filename
  * size
  * md5_digest
  * downloads
  * has_sig
  * python_version (required version, or 'source', or 'any')
  * comment_text

'''release_data(package_name, version)'''

 . Retrieve metadata describing a specific package release. Returns a dict with keys for:
  * name
  * version
  * stable_version
  * author
  * author_email
  * maintainer
  * maintainer_email
  * home_page
  * license
  * summary
  * description
  * keywords
  * platform
  * download_url
  * classifiers (list of classifier strings)
  * requires
  * requires_dist
  * provides
  * provides_dist
  * requires_external
  * requires_python
  * obsoletes
  * obsoletes_dist
  * project_url
  * docs_url (URL of the packages.python.org docs if they've been supplied)
 If the release does not exist, an empty dictionary is returned.

'''search(spec[, operator])'''

 . Search the package database using the indicated search spec.

 . The spec may include any of the keywords described in the above list (except 'stable_version' and 'classifiers'), for example: {'description': 'spam'} will search description fields. Within the spec, a field's value can be a string or a list of strings (the values within the list are combined with an OR), for example: {'name': ['foo', 'bar']}. Valid keys for the spec dict are listed here. Invalid keys are ignored:
  * name
  * version
  * author
  * author_email
  * maintainer
  * maintainer_email
  * home_page
  * license
  * summary
  * description
  * keywords
  * platform
  * download_url
 Arguments for different fields are combined using either "and" (the default) or "or". Example: search({'name': 'foo', 'description': 'bar'}, 'or'). The results are returned as a list of dicts {'name': package name, 'version': package release version, 'summary': package release summary}

'''browse(classifiers)'''

 . Retrieve a list of (name, version) pairs of all releases classified with all of the given classifiers. 'classifiers' must be a list of Trove classifier strings.

'''changelog(since, with_ids=False)'''

 . Retrieve a list of four-tuples (name, version, timestamp, action), or five-tuple including the serial id if ids are requested, since the given timestamp. All timestamps are UTC values. The argument is a UTC integer seconds since the epoch.

'''changelog_last_serial()'''

 . Retrieve the last event's serial id.

'''changelog_since_serial(since_serial)'''

 . Retrieve a list of five-tuples (name, version, timestamp, action, serial) since the event identified by the given serial. All timestamps are UTC values. The argument is a UTC integer seconds since the epoch.

----
CategoryDocumentation CategoryDocumentation

PyPI APIs: Simple, JSON, XMLRPC.

The XMLRPC interface for PyPI is considered legacy and should not be used.

Use the Simple and JSON APIs.

PyPI's XML-RPC methods

Example usage:

>>> try:
>>>     import xmlrpclib
>>> except ImportError:
>>>     import xmlrpc.client as xmlrpclib
>>> import pprint
>>> client = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')
>>> client.package_releases('roundup')
['1.4.10']
>>> pprint.pprint(client.release_urls('roundup', '1.4.10'))
[{'comment_text': '',
  'downloads': 3163,
  'filename': 'roundup-1.1.2.tar.gz',
  'has_sig': True,
  'md5_digest': '7c395da56412e263d7600fa7f0afa2e5',
  'packagetype': 'sdist',
  'python_version': 'source',
  'size': 876455,
  'upload_time': <DateTime '20060427T06:22:35' at 912fecc>,
  'url': 'http://pypi.python.org/packages/source/r/roundup/roundup-1.1.2.tar.gz'},
 {'comment_text': '',
  'downloads': 2067,
  'filename': 'roundup-1.1.2.win32.exe',
  'has_sig': True,
  'md5_digest': '983d565b0b87f83f1b6460e54554a845',
  'packagetype': 'bdist_wininst',
  'python_version': 'any',
  'size': 614270,
  'upload_time': <DateTime '20060427T06:26:04' at 912fdec>,
  'url': 'http://pypi.python.org/packages/any/r/roundup/roundup-1.1.2.win32.exe'}]

list_packages()

  • Retrieve a list of the package names registered with the package index. Returns a list of name strings.

package_releases(package_name, show_hidden=False)

  • Retrieve a list of the releases registered for the given package_name. Returns a list with all version strings if show_hidden is True or only the non-hidden ones otherwise.

package_roles(package_name)

  • Retrieve a list of users and their attributes roles for a given package_name. Role is either 'Maintainer' or 'Owner'.

user_packages(user)

  • Retrieve a list of [role_name, package_name] for a given username. Role is either 'Maintainer' or 'Owner'.

release_downloads(package_name, version)

  • Retrieve a list of files and download count for a given package and release version.

release_urls(package_name, version)

  • Retrieve a list of download URLs for the given package release. Returns a list of dicts with the following keys:
    • url
    • packagetype ('sdist', 'bdist', etc)
    • filename
    • size
    • md5_digest
    • downloads
    • has_sig
    • python_version (required version, or 'source', or 'any')
    • comment_text

release_data(package_name, version)

  • Retrieve metadata describing a specific package release. Returns a dict with keys for:
    • name
    • version
    • stable_version
    • author
    • author_email
    • maintainer
    • maintainer_email
    • home_page
    • license
    • summary
    • description
    • keywords
    • platform
    • download_url
    • classifiers (list of classifier strings)
    • requires
    • requires_dist
    • provides
    • provides_dist
    • requires_external
    • requires_python
    • obsoletes
    • obsoletes_dist
    • project_url
    • docs_url (URL of the packages.python.org docs if they've been supplied)
    If the release does not exist, an empty dictionary is returned.

search(spec[, operator])

  • Search the package database using the indicated search spec.
  • The spec may include any of the keywords described in the above list (except 'stable_version' and 'classifiers'), for example: {'description': 'spam'} will search description fields. Within the spec, a field's value can be a string or a list of strings (the values within the list are combined with an OR), for example: {'name': ['foo', 'bar']}. Valid keys for the spec dict are listed here. Invalid keys are ignored:
    • name
    • version
    • author
    • author_email
    • maintainer
    • maintainer_email
    • home_page
    • license
    • summary
    • description
    • keywords
    • platform
    • download_url
    Arguments for different fields are combined using either "and" (the default) or "or". Example: search({'name': 'foo', 'description': 'bar'}, 'or'). The results are returned as a list of dicts {'name': package name, 'version': package release version, 'summary': package release summary}

browse(classifiers)

  • Retrieve a list of (name, version) pairs of all releases classified with all of the given classifiers. 'classifiers' must be a list of Trove classifier strings.

changelog(since, with_ids=False)

  • Retrieve a list of four-tuples (name, version, timestamp, action), or five-tuple including the serial id if ids are requested, since the given timestamp. All timestamps are UTC values. The argument is a UTC integer seconds since the epoch.

changelog_last_serial()

  • Retrieve the last event's serial id.

changelog_since_serial(since_serial)

  • Retrieve a list of five-tuples (name, version, timestamp, action, serial) since the event identified by the given serial. All timestamps are UTC values. The argument is a UTC integer seconds since the epoch.


CategoryDocumentation CategoryDocumentation

PyPIXmlRpc (last edited 2018-07-10 16:43:27 by EWDurbin)

Unable to edit the page? See the FrontPage for instructions.