libere-tes-chaine-de-mots/import_data/utils/get_ids.py
2024-07-18 20:04:51 -04:00

16 lines
507 B
Python

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]