20 lines
674 B
Python
20 lines
674 B
Python
|
import streamlit as st
|
||
|
|
||
|
from import_data.utils.typesense_client import client
|
||
|
|
||
|
|
||
|
def recuperer_reseaux():
|
||
|
search_parameters = {
|
||
|
'q': '*',
|
||
|
'query_by': 'network',
|
||
|
'facet_by': 'network',
|
||
|
'per_page': 0
|
||
|
}
|
||
|
try:
|
||
|
results = client.collections['social_media_posts'].documents.search(search_parameters)
|
||
|
networks = [facet['value'] for facet in results['facet_counts'][0]['counts']]
|
||
|
return networks
|
||
|
except Exception as e:
|
||
|
st.error(f"Erreur lors de la récupération des réseaux : {str(e)}")
|
||
|
return ['Facebook', 'Instagram', 'Threads', 'LinkedIn', 'WordPress'] # Valeurs par défaut en cas d'erreur
|