mrtools

Python functions for accessing search results from MathSciNet and downloading BibTeX bibliographies associated to the results

listb.mrtools.crawl(url)[source]

Crawls specified URL on MathSciNet

If the search result is split into 5 pages and the URL to page 3 is passed then the source codes and URLs of pages 3, 4, and 5 are returned.

Parameters:url (str) – URL pointing to a search page on MathSciNet
Returns:List of page source codes and list of URLs
Return type:(List[str], List[str])

Note

To use this fuction you need to have access to MathSciNet.

listb.mrtools.get_bibtex_from_msn(mrnumbers, outfile=None)[source]

Fetches BibTeX file from MathSciNet server using the MR-numbers

Parameters:
  • mrnumbers (List[str]) – the BibTeX entries for these MR-numbers are retrieved
  • outfile (Opitonal[str]) – path to output file
Returns:

BibTeX file as string

Return type:

str

Note

To use this fuction you need to have access to MathSciNet.

Example

>>> print(get_bibtex_from_msn(['0241312'])) 
@article {MR0241312,
    AUTHOR = {Shelah, Saharon},
     TITLE = {Note on a min-max problem of {L}eo {M}oser},
   JOURNAL = {J. Combinatorial Theory},
    VOLUME = {6},
      YEAR = {1969},
     PAGES = {298--300},
   MRCLASS = {05.04},
  MRNUMBER = {0241312},
MRREVIEWER = {G. F. Clements},
}
listb.mrtools.get_mrnumber(doc)[source]

Extracts MR-number from the “headlineText” of the search result

Parameters:doc (bs4.element.Tag) – headlineText
Returns:MR-number
Return type:str
listb.mrtools.PAT

_sre.SRE_Pattern – precompiled pattern for extracting the MR-number

listb.mrtools.msn_to_mrnumbers(msn, outfile=None)[source]

Retrieves MR-numbers from the source code of a search page

Parameters:
  • msn (str OR file handle) – source code of the search result
  • Optional[str] (outfile) – if specified the MR-numbers get written to a yaml file located at the path
Returns:

List of MR-numbers found on page

Return type:

List[str]

Example

>>> msn = '''<div class="headlineText">
...            <a class="mrnum" title="Full MathSciNet Item"
...             href="[...]"><strong>MR3549381</strong></a>
...          </div>'''
>>> msn_to_mrnumbers(msn)
['3549381']
listb.mrtools.yaml_dump(data, path)[source]

Dumps data into yaml file at path

Parameters:
  • data (Dict[Any], etc.) – data to be dumped
  • path (str) – path to yaml file
listb.mrtools.yaml_dumps(data, handle)[source]

Dumps data into handle

Parameters:
  • data (Dict[Any], etc.) – data to be dumped
  • handle (handle) – handle the data should be dumped into