Skip to content
Snippets Groups Projects
Commit b406ccee authored by Georges Gressot's avatar Georges Gressot :speech_balloon:
Browse files

etc

parent 8a35c5fc
Branches
No related merge requests found
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:code id: tags:
```
# @title String fields
Nom_du_labo = 'bidon' # @param {type:"string"}
Code_labo = '207480' # @param {type:"string"}
Nom_du_labo = '' # @param {"type":"string","placeholder":"Par exemple : isis"}
Code_labo = '' # @param {"type":"string","placeholder":"Par exemple : 207480"}
# @title Date fields
Date_de_début = '2016-01-01' # @param {type:"date"}
Date_de_fin = '2024-11-20' # @param {type:"date"}
Date_de_fin = '' # @param {type:"date"}
import requests
import urllib.request
import io
import pandas as pd
# The API endpoint
url = "https://api.archives-ouvertes.fr/search/UNIV-STRASBG/?fq=structId_i:" + \
Code_labo + "&rows=20000&wt=csv&fq=publicationDate_tdate:%5B" + Date_de_début +\
"T00:00:00Z%20TO%20" + Date_de_fin + "T00:00:00Z%5D&fq=-doiId_s"
# A GET request to the API
fichier = urllib.request.urlretrieve(url, "bidon.csv")
response = requests.get(url)
df = pd.read_csv(io.StringIO(response.text))
try:
test = df.halId_s
print("Cliquez sur le lien suivant pour télécharger votre extraction : {}".format(url))
print("Votre fichier a bien été téléchargé")
print(test)
except:
print("Vérifiez vos saisies ou recommencez plus tard.")
exit()
```
%% Output
Cliquez sur le lien suivant pour télécharger votre extraction : https://api.archives-ouvertes.fr/search/UNIV-STRASBG/?fq=structId_i:207480&rows=20000&wt=csv&fq=publicationDate_tdate:%5B2016-01-01T00:00:00Z%20TO%202024-11-20T00:00:00Z%5D&fq=-doiId_s
Votre fichier a bien été téléchargé
0 tel-01715300
1 hal-04043752
2 hal-03721750
3 hal-03343101
4 hal-03933852
...
671 hal-03388540
672 hal-03551437
673 hal-04280351
674 hal-02907196
675 hal-04352016
Name: halId_s, Length: 676, dtype: object
%% Cell type:code id: tags:
```
```
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment