|
7 | 7 | # Copyright (C) 2023 - Andrés Becerra <[email protected]>
|
8 | 8 | #
|
9 | 9 | # 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 |
11 | 11 | # published by the Free Software Foundation.
|
12 | 12 | #
|
13 | 13 | # This program is distributed in the hope that it will be useful,
|
@@ -2716,8 +2716,8 @@ def fetchBibtex(doi: str) -> str:
|
2716 | 2716 | returns the bibtex bibliography for the doi
|
2717 | 2717 | raises an exception if the dx.doi.org service fails
|
2718 | 2718 | """
|
2719 |
| - # accept = {'accept': 'application/x-bibtex'} |
2720 |
| - accept = {'accept': 'application/json'} |
| 2719 | + accept = {'accept': 'application/x-bibtex'} |
| 2720 | + # accept = {'accept': 'application/json'} |
2721 | 2721 | url = f'http://dx.doi.org/{doi}'
|
2722 | 2722 | req = Request(url, headers=accept)
|
2723 | 2723 | try:
|
@@ -2764,11 +2764,11 @@ def doi2bibtex(doi: str) -> None:
|
2764 | 2764 | """
|
2765 | 2765 | try:
|
2766 | 2766 | 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.') |
2772 | 2772 | except Exception as error:
|
2773 | 2773 | print(f'Error processing {doi}:\n {error.reason}')
|
2774 | 2774 |
|
|
0 commit comments