biblib icon indicating copy to clipboard operation
biblib copied to clipboard

About PyPI package?

Open KelSolaar opened this issue 6 years ago • 1 comments

Hi,

So there is a biblib package on PyPI which is unfortunately not the correct one, I was wondering though if there was any plan for releasing this one though. It would be super convenient for automation.

Cheers,

Thomas

KelSolaar avatar Mar 18 '19 08:03 KelSolaar

You can install like so:

pip install -e git+https://github.com/aclements/biblib.git#egg=biblib

Also works as a separate line in your requirements.txt file:

-e git+https://github.com/aclements/biblib.git#egg=biblib

Working example after installing as above:

from biblib.bib import Parser as BibParser
import requests

def resolve_doi(doi):
    bibtext = requests.get(f'https://doi.org/{doi}', headers={
        'Accept': 'application/x-bibtex; charset=utf-8'
    }).text

    parser = BibParser()
    parser.parse(bibtext)
    entries = parser.get_entries()

    return dict(next(iter(entries.values())))

radusuciu avatar Jul 20 '20 17:07 radusuciu