blob: 14602cefc1c705bd6a541559ab8b010cce1de18b [file] [log] [blame]
Éric Araujo3a9f58f2011-06-01 20:42:49 +02001: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
8Packaging queries PyPI to get information about projects or download them. The
9low-level facilities used internally are also part of the public API designed to
10be used by other tools.
11
12The :mod:`packaging.pypi` package provides those facilities, which can be
13used to access information about Python projects registered at indexes, the
14main one being PyPI, located ad http://pypi.python.org/.
15
16There is two ways to retrieve data from these indexes: a screen-scraping
17interface called the "simple API", and XML-RPC. The first one uses HTML pages
18located under http://pypi.python.org/simple/, the second one makes XML-RPC
19requests to http://pypi.python.org/pypi/. All functions and classes also work
20with other indexes such as mirrors, which typically implement only the simple
21interface.
22
23Packaging provides a class that wraps both APIs to provide full query and
24download functionality: :class:`packaging.pypi.client.ClientWrapper`. If you
25want more control, you can use the underlying classes
26:class:`packaging.pypi.simple.Crawler` and :class:`packaging.pypi.xmlrpc.Client`
27to 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
38This module provides a high-level API to query indexes and search
39for releases and distributions. The aim of this module is to choose the best
40way to query the API automatically, either using XML-RPC or the simple index,
41with 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 Araujoe043b6b2011-06-19 19:23:48 +020054
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.