Package doapfiend :: Module doaplib
[hide private]
[frames] | no frames]

Module doaplib

source code

Library for parsing, displaying, querying and serializing DOAP

Functions [hide private]
Project
load(doap, format='xml')
Load a DOAP profile into a graph
source code
string
get_by_pkg_index(index, project_name, proxy=None)
Get DOAP for a package index project name
source code
list
query_by_homepage(url)
Get list of URL's for DOAP given a project's homepage.
source code
 
display_doap(doap_xml, serialize='text', brief=False)
Print DOAP as text, xml, or n3
source code
text
fetch_doap(url, proxy=None)
Fetch DOAP by its URL or filename
source code
Variables [hide private]
  XMLRPC_SERVER = <ServerProxy for doapspace.org/xmlrpc/>
  PKG_INDEX_URI = 'http://doapspace.org/doap'
Function Details [hide private]

load(doap, format='xml')

source code 

Load a DOAP profile into a graph

Supports any serialization format rdflib can parse (xml, n3, etc.)

Parameters:
  • doap (string) - DOAP
  • format (string) - Serialization format we're parsing
Returns: Project
a Project{rdfSubject}

get_by_pkg_index(index, project_name, proxy=None)

source code 

Get DOAP for a package index project name

Current indexes:

  • 'sf' SourceForge
  • 'fm' Freshmeat
  • 'py' Python Package Index

Raises doaplib.utils.NotFound exception on HTTP 404 error

Parameters:
  • index (string) - Package index two letter abbreviation
  • project_name (string) - project name
  • proxy (string) - Optional HTTP proxy URL
Returns: string
text of file retrieved

query_by_homepage(url)

source code 

Get list of URL's for DOAP given a project's homepage. The list can contain zero or multiple URLs.

The return format is: [(source, URL), (source, URL)...]

'source' is the two letter package index abbreviation or 'ex' for external. 'external' meaning the DOAP was spidered on the web. Possible package indexes:

Current indexes:

  • 'sf' SourceForge
  • 'fm' Freshmeat
  • 'py' Python Package Index
Parameters:
  • url (string) - URL of homepage of a project
Returns: list
A list of tuples containing URLs for DOAP found by homepage

display_doap(doap_xml, serialize='text', brief=False)

source code 

Print DOAP as text, xml, or n3

Parameters:
  • doap_xml (string) - DOAP profile in RDF/XML
  • serialize (string) - Serialization syntax
  • brief (boolean) - Only show brief info when serializing as plain text
Returns:
None on success, 2 on invalid serialization request

fetch_doap(url, proxy=None)

source code 

Fetch DOAP by its URL or filename

Parameters:
  • url (string) - URL of DOAP profile in RDF/XML serialization
Returns: text
DOAP