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 OHLOH_URI = 'http://rdfohloh.wikier.org/project/'
13
14
16 '''
17 Get DOAP for a package index project name from doapspace.org
18
19 Builtin indexes:
20
21 - 'sf' SourceForge
22 - 'fm' Freshmeat
23 - 'py' Python Package Index
24 - 'oh' Project listed on Ohlo
25
26 Raises doaplib.utils.NotFound exception on HTTP 404 error
27
28 @param index: Package index two letter abbreviation
29 @type index: string
30
31 @param project_name: project name
32 @type project_name: string
33
34 @param proxy: Optional HTTP proxy URL
35 @type proxy: string
36
37 @rtype: string
38 @return: text of file retrieved
39
40 '''
41 if index == 'oh':
42 url = '%s/%s/rdf' % (OHLOH_URI, project_name)
43 else:
44 url = '%s/%s/%s' % (PKG_INDEX_URI, index, project_name)
45 return fetch_file(url, proxy)
46