Commit 46fcb201 authored by Nicolas Atrax's avatar Nicolas Atrax

Update Isidore_To_GarganText.py

parent 1f7ce4b2
......@@ -7,6 +7,7 @@ import streamlit as st
import requests as req
import json
import time
from json import JSONDecodeError
import src.basic as tmp
......@@ -18,15 +19,21 @@ retryTime = 2
def loadApiIsidoreNumberFile(search, language):
url = 'https://api.isidore.science/resource/search?q=' + search + \
'&output=json&replies=10&language=http://lexvo.org/id/iso639-3/' + language
resp = req.get(url)
print(url)
if resp.ok:
jsontxt = json.loads(resp.content)
docs = jsontxt["response"]["replies"]["meta"]["@items"]
else:
docs = 0
while (True):
url = 'https://api.isidore.science/resource/search?q=' + search + \
'&output=json&replies=10&language=http://lexvo.org/id/iso639-3/' + language
st.session_state.resp = req.get(url)
print(url)
if st.session_state.resp.ok:
try:
jsontxt = json.loads(st.session_state.resp.content)
docs = jsontxt["response"]["replies"]["meta"]["@items"]
break
except JSONDecodeError:
continue
else:
docs = 0
break
return docs
......
Markdown is supported
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