Éric Araujo | 3a9f58f | 2011-06-01 20:42:49 +0200 | [diff] [blame] | 1 | :mod:`packaging.pypi` --- Interface to projects indexes |
| 2 | ======================================================= |
| 3 | |
| 4 | .. module:: packaging.pypi |
| 5 | :synopsis: Low-level and high-level APIs to query projects indexes. |
| 6 | |
| 7 | |
| 8 | Packaging queries PyPI to get information about projects or download them. The |
| 9 | low-level facilities used internally are also part of the public API designed to |
| 10 | be used by other tools. |
| 11 | |
| 12 | The :mod:`packaging.pypi` package provides those facilities, which can be |
| 13 | used to access information about Python projects registered at indexes, the |
| 14 | main one being PyPI, located ad http://pypi.python.org/. |
| 15 | |
| 16 | There is two ways to retrieve data from these indexes: a screen-scraping |
| 17 | interface called the "simple API", and XML-RPC. The first one uses HTML pages |
| 18 | located under http://pypi.python.org/simple/, the second one makes XML-RPC |
| 19 | requests to http://pypi.python.org/pypi/. All functions and classes also work |
| 20 | with other indexes such as mirrors, which typically implement only the simple |
| 21 | interface. |
| 22 | |
| 23 | Packaging provides a class that wraps both APIs to provide full query and |
| 24 | download functionality: :class:`packaging.pypi.client.ClientWrapper`. If you |
| 25 | want more control, you can use the underlying classes |
| 26 | :class:`packaging.pypi.simple.Crawler` and :class:`packaging.pypi.xmlrpc.Client` |
| 27 | to connect to one specific interface. |
| 28 | |
| 29 | |
| 30 | :mod:`packaging.pypi.client` --- High-level query API |
| 31 | ===================================================== |
| 32 | |
| 33 | .. module:: packaging.pypi.client |
| 34 | :synopsis: Wrapper around :mod;`packaging.pypi.xmlrpc` and |
| 35 | :mod:`packaging.pypi.simple` to query indexes. |
| 36 | |
| 37 | |
| 38 | This module provides a high-level API to query indexes and search |
| 39 | for releases and distributions. The aim of this module is to choose the best |
| 40 | way to query the API automatically, either using XML-RPC or the simple index, |
| 41 | with a preference toward the latter. |
| 42 | |
| 43 | .. class:: ClientWrapper |
| 44 | |
| 45 | Instances of this class will use the simple interface or XML-RPC requests to |
| 46 | query indexes and return :class:`packaging.pypi.dist.ReleaseInfo` and |
| 47 | :class:`packaging.pypi.dist.ReleasesList` objects. |
| 48 | |
| 49 | .. method:: find_projects |
| 50 | |
| 51 | .. method:: get_release |
| 52 | |
| 53 | .. method:: get_releases |
Éric Araujo | e043b6b | 2011-06-19 19:23:48 +0200 | [diff] [blame] | 54 | |
| 55 | |
| 56 | :mod:`packaging.pypi.base` --- Base class for index crawlers |
| 57 | ============================================================ |
| 58 | |
| 59 | .. module:: packaging.pypi.base |
| 60 | :synopsis: Base class used to implement crawlers. |
| 61 | |
| 62 | |
| 63 | .. class:: BaseClient(prefer_final, prefer_source) |
| 64 | |
| 65 | Base class containing common methods for the index crawlers or clients. One |
| 66 | method is currently defined: |
| 67 | |
| 68 | .. method:: download_distribution(requirements, temp_path=None, \ |
| 69 | prefer_source=None, prefer_final=None) |
| 70 | |
| 71 | Download a distribution from the last release according to the |
| 72 | requirements. If *temp_path* is provided, download to this path, |
| 73 | otherwise, create a temporary directory for the download. If a release is |
| 74 | found, the full path to the downloaded file is returned. |