Skip to content

Commit 351710c

Browse files
committed
Restore bibtex from dx.doi
1 parent 0a01c70 commit 351710c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pid2bib.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Copyright (C) 2023 - Andrés Becerra <[email protected]>
88
#
99
# This program is free software; you can redistribute it and/or modify
10-
# it under the terms of the GNU General Public License, version 3, as
10+
# it under the terms of the GNU General Public License, version 2, as
1111
# published by the Free Software Foundation.
1212
#
1313
# This program is distributed in the hope that it will be useful,
@@ -2716,8 +2716,8 @@ def fetchBibtex(doi: str) -> str:
27162716
returns the bibtex bibliography for the doi
27172717
raises an exception if the dx.doi.org service fails
27182718
"""
2719-
# accept = {'accept': 'application/x-bibtex'}
2720-
accept = {'accept': 'application/json'}
2719+
accept = {'accept': 'application/x-bibtex'}
2720+
# accept = {'accept': 'application/json'}
27212721
url = f'http://dx.doi.org/{doi}'
27222722
req = Request(url, headers=accept)
27232723
try:
@@ -2764,11 +2764,11 @@ def doi2bibtex(doi: str) -> None:
27642764
"""
27652765
try:
27662766
bibtex_content = fetchBibtex(doi)
2767-
print(bibtex_content)
2768-
# title = getTitle(bibtex_content)
2769-
# filename = sanitizeFileName(title) + '.bib'
2770-
# createFile(filename, bibtex_content)
2771-
# print(f'File "{filename}" was created.')
2767+
# print(bibtex_content)
2768+
title = getTitle(bibtex_content)
2769+
filename = sanitizeFileName(title) + '.bib'
2770+
createFile(filename, bibtex_content)
2771+
print(f'File "{filename}" was created.')
27722772
except Exception as error:
27732773
print(f'Error processing {doi}:\n {error.reason}')
27742774

0 commit comments

Comments
 (0)