Dev module

Note

To access this functions you need to extend the lib by importing biblib.dev.

biblib.dev.parse_data(data, decode=False)[source]

(Wrapper) Function for parsing a (unicode) string of BibTeX data containing one or more entries and returns a list of dictionaries (records).

Note

Uses pybtex.database.parse_string() for parsing.

Parameters:

data (unicode) – input BibTeX data

Returns:

list of dicts

Return type:

list

Raises:
  • pybtex.scanner.TokenRequired – If a citation-key is missed.
  • pybtex.database.BibliographyDataError – If a citation-key is used twice.
biblib.dev.latex_to_string(string)[source]

Convert a LaTeX string to its unicode equivalent.

Parameters:string (str) – string to convert
Returns:string
Return type:str
biblib.dev.string_to_latex(string)[source]

Convert a string to its LaTeX equivalent.

Parameters:string (unicode) – string to convert
Returns:string
Return type:str
biblib.dev.doi2bibtex(doi)[source]

Returns the BibTeX citation Entry for a publication with a given DOI, by using the web service of https://www.doi.org.

Parameters:

doi (str) – DOI of the publication

Returns:

the formatted BibTeX Entry of the publication

Return type:

str

Raises:
  • biblib.dev.DOIError – if DOI didn’t exist or no contents is available
  • urllib2.URLError – if a connection error occurs
biblib.dev.isbn2bibtex(isbn)[source]

Returns the BibTeX citation Entry for a publication with a given ISBN.

Parameters:isbn (str) – International Standard Book Number (ISBN)
Returns:the formatted BibTeX Entry of the publication
Return type:str
class biblib.dev.DOIError(code)[source]

Exception raised for errors with the request of a BibTeX citation Entry at http://dx.doi.org by the DOI.

Beside the conventional meaning of HTTP response status codes, the following codes are redefined:

  • 204: The request was OK but there was no metadata available.
  • 404: The DOI requested doesn’t exist.
  • 406: Can’t serve requested content type.
Parameters:code (int) – HTTPError code send by dx.doi.org