Use OF API from package enerbitdso 0.1.8 PYPI
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 01:39 PM
Hello! I have code to use an API supplied in the energitdso package (This is the repository https://pypi.org/project/enerbitdso/). I changed the code adapting it to AZURE DATABRICKS in python, but although there is a connection with the API, it does not return results. This is my code:
# Instalar enerbitdso (asegúrese de que esto se ejecuta sin errores)
%pip install enerbitdso
# Importar librerías
import os
from dotenv import load_dotenv
# Ruta relativa al archivo .env
env_file_path = "./.env"
# Cargar las variables de entorno desde el archivo .env
load_dotenv(env_file_path)
# Acceder a las variables de entorno
api_base_url = os.getenv("ENERBIT_API_BASE_URL")
api_username = os.getenv("ENERBIT_API_USERNAME")
api_password = os.getenv("ENERBIT_API_PASSWORD")
# Mostrar las variables de entorno (para verificar la carga correcta)
print(f"API Base URL: {api_base_url}")
print(f"API Username: {api_username}")
print(f"API Password: {api_password}") # **Nota:** Evite compartir credenciales reales en el código
# Ejecutar la consulta de uso de enerbitdso
# Asegúrese de tener los permisos necesarios para los códigos FRT especificados
!enerbitdso usages fetch Frt08942 Frt46756 Frt47799
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 12:59 PM
The owner of the package updated it to use the time out as a parameter of up to 20 seconds and updated a dependent package in DataBricks, with the above the problem was solved