From 3e515446b4f6dd7551f5e3f69661a57863204f38 Mon Sep 17 00:00:00 2001 From: Chetouane <elias.chetouane@univ-grenoble-alpes.fr> Date: Fri, 1 Dec 2023 16:06:03 +0100 Subject: [PATCH] =?UTF-8?q?Modification=20pour=20fonctionnement=20avec=20r?= =?UTF-8?q?un-all-codes.py=20->=20=C3=A0=20tester?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0-collect-data/datacite.py | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/0-collect-data/datacite.py b/0-collect-data/datacite.py index cb5f3ca..8e12466 100644 --- a/0-collect-data/datacite.py +++ b/0-collect-data/datacite.py @@ -1,16 +1,6 @@ -#!/usr/bin/env python -# coding: utf-8 - -# In[1]: - - # récupérer les DOIs de l'UGA depuis Datacite ## 2023-12-01, Elias Chetouane - -# In[12]: - - """ ## todo - recherche par affiliation contributeurs ? @@ -21,15 +11,9 @@ * Pagination : https://support.datacite.org/docs/pagination """ - -# In[13]: - - import requests, json - -# In[14]: - +folder = "0-collect-data/" # requête url de base url = 'https://api.datacite.org/dois?affiliation=true&query=creators.affiliation.affiliationIdentifier:"https://ror.org/02rx3b187"&page[size]=100' @@ -47,10 +31,6 @@ while(page < nb_pages): results.append(req.json()) page += 1 - -# In[15]: - - # ajouter les DOIs dans une liste, sans ajouter les résultats qui ne sont pas des DOIs dois = [] @@ -72,12 +52,8 @@ for res in results: print("Nombre de résultats trouvés : " + str(nb_dois)) - -# In[43]: - - # exporter la liste de DOI au format txt -with open("datacite-dois.txt", 'w') as f : +with open(folder+"datacite-dois.txt", 'w') as f : [f.write(f"{line}\n") for line in dois] -- GitLab