3.9 KiB
3.9 KiB
In [5]:
import requests
import json
In [61]:
headers = {
'Accept': 'application/json',
}
response = requests.get('https://api.issn.org/authenticate/[user]/[param]', headers=headers)
In [14]:
ACCESS_TOKEN = json.loads(response.text)['token']
In [36]:
#downloading closed from oaire
fin = open('./input/OpenAireClosed.json')
fout = open('downloadedITNotOpen.json','w')
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'JWT ' + ACCESS_TOKEN
}
params = {
'natifjson': 'true',
}
lines = fin.read()
dic = json.loads(lines[0])
downloaded = []
for entry in dic:
issn = ''
if 'issnPrinted' in entry and entry['issnPrinted'] != '':
issn = entry['issnPrinted']
elif 'issnOnline' in entry and entry['issnOnline'] != '':
issn = entry['issnOnline']
if issn!='' and not issn in downloaded:
json_data = {"search":[issn], 'page':0, 'size':10}
response = requests.post('https://api.issn.org/search', params=params, headers=headers, json=json_data)
fout.write(json.dumps(response.text) + "\n")
downloaded.append(issn)
fout.close()
In [1]:
#downloading closed from oalex
fin = open('./input/itClosedFromOpenAlex.json')
fout = open('downloadedItNotOpenoalex.json','w')
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'JWT ' + ACCESS_TOKEN
}
params = {
'natifjson': 'true',
}
lines = fin.read().split("\n")
downloaded = []
for line in lines:
if line == '':
continue
dic = json.loads(line[:-1])
issn = ''
if 'issn_l' in dic and dic['issn_l'] != '':
issn = dic['issn_l']
elif 'issn' in dic and len(dic['issn']) >= 1:
issn = dic['issn'][0]
if issn!='' and not issn in downloaded:
json_data = {"search":[issn], 'page':0, 'size':10}
response = requests.post('https://api.issn.org/search', params=params, headers=headers, json=json_data)
fout.write(response.text + "\n")
downloaded.append(issn)
fout.close()