doapfiend.plugins.pkg_index

Package doapfiend :: Package plugins :: Module pkg_index |
[hide private]
[frames] | no frames]

# Source Code for Module doapfiend.plugins.pkg_index

     1
     2  '''
     3
     4  Plugin helper to fetch a single DOAP file from doapspace.org
     5  by Package Index
     6
     7  '''
     8
     9  from doapfiend.utils import fetch_file
    10
    11  PKG_INDEX_URI = 'http://doapspace.org/doap'
    12
    13
    14 -def get_by_pkg_index(index, project_name, proxy=None):
    15      '''
    16      Get DOAP for a package index project name from doapspace.org
    17
    18      Builtin indexes:
    19
    20         - 'sf' SourceForge
    21         - 'fm' Freshmeat
    22         - 'py' Python Package Index
    23
    24      Raises doaplib.utils.NotFound exception on HTTP 404 error
    25
    26      @param index: Package index two letter abbreviation
    27      @type index: string
    28
    29      @param project_name: project name
    30      @type project_name: string
    31
    32      @param proxy: Optional HTTP proxy URL
    33      @type proxy: string
    34
    35      @rtype: string
    36      @return: text of file retrieved
    37
    38      '''
    39      url = '%s/%s/%s' % (PKG_INDEX_URI, index, project_name)
    40      return fetch_file(url, proxy)
    41