libere-tes-chaine-de-mots/import_data/utils/get_ids.py

17 lines
507 B
Python
Raw Normal View History

import pandas as pd
import requests
import utils.config as config
API_URL = config.API_URL
def get_idreseausocial(nom, endpoint=f"{API_URL}/reseauxsociaux/"):
reseaux_sociaux = pd.DataFrame(requests.get(endpoint).json())
return list(reseaux_sociaux[reseaux_sociaux["nom"] == nom]["id"])[0]
def get_idtypedocument(nom, endpoint=f"{API_URL}/typedocuments/"):
type_documents = pd.DataFrame(requests.get(endpoint).json())
return list(type_documents[type_documents["nom"] == nom]["id"])[0]