Exemplo n.º 1
0
def fetch_bibtex_by_doi(doi):
    url = "http://api.crossref.org/works/" + doi + "/transform/application/x-bibtex"
    work = Works(etiquette=my_etiquette)
    bibtex = work.do_http_request('get',
                                  url,
                                  custom_header=str(work.etiquette)).text
    return bibtex.strip()
Exemplo n.º 2
0
def fetch_json_by_doi(doi):
    url = "http://api.crossref.org/works/" + doi + "/transform/application/json"
    work = Works(etiquette=my_etiquette)
    jsontxt = work.do_http_request('get',
                                   url,
                                   custom_header=str(work.etiquette)).text
    return jsontxt.dumps(json)
Exemplo n.º 3
0
def fetch_bibtex_by_doi(doi):
    url = "http://api.crossref.org/works/" + doi + "/transform/application/x-bibtex"
    work = Works(etiquette=my_etiquette)
    response = work.do_http_request(
        'get', url, custom_header={'user-agent': str(work.etiquette)})
    if response.ok:
        bibtex = response.text.strip()
        return bibtex
    raise DOIRequestError(repr(doi) + ': ' + response.text)
Exemplo n.º 4
0
def write_bibtex_v1(bibtex_file, dois):
    my_etiquette = Etiquette('VTLibraries', 0.1, 'https://lib.vt.edu/', '*****@*****.**')
    work = Works(etiquette=my_etiquette)
    with open(bibtex_file, 'w') as bib:
        for doi in dois:
            url = "http://api.crossref.org/works/" + doi + "/transform/application/x-bibtex"
            jsontxt = work.do_http_request('get', url, custom_header=str(work.etiquette)).text
            if not jsontxt.startswith('Resource'):
                bib.writelines(jsontxt)
                bib.write('\n')