Skip to content

Commit

Permalink
feature JabRef#6189 journal button
Browse files Browse the repository at this point in the history
    - added initial python script to generate JSON from an API call
    - Is currently using Crossref API
  • Loading branch information
David Yu authored and David Yu committed Mar 3, 2021
1 parent d4afb81 commit 9ac3f9b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scripts/journal-data-generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import urllib3
import json

http = urllib3.PoolManager()

crossref_base_url = 'https://api.crossref.org/journals'

def crossref_with_ISSN(ISSN):
url = crossref_base_url + '/' + ISSN
print(url)
return http.request('GET', url)

# Test endpoint: https://api.crossref.org/journals/2158-5571
response = crossref_with_ISSN('2158-5571')
print(response.status)
# print(type(response.data))

data = json.loads(response.data.decode('utf-8'))

with open('data.json', 'w') as json_file:
json.dump(data, json_file)

0 comments on commit 9ac3f9b

Please sign in to comment.