| |
|
| | class Demos: |
| | def __init__(self): |
| | from fastapi import FastAPI, HTTPException |
| | self.api = FastAPI |
| | self.exception = HTTPException |
| | def validate_apikey(self,api_key)->bool: |
| | __validation = True |
| | return __validation |
| | @staticmethod |
| | def obtener_texto(from_url:str|None,from_pdf:str|None)->str: |
| | """Obtiene texto a partir de una fuente de información: desde url o desde pdf. |
| | |
| | args: |
| | from_url (str) : Url desde la que se desea obtener información. |
| | from_pdf (str) : Pdf desde el que se desea obtener información. |
| | return: |
| | _texto (str) : Texto extraído desde la fuente dada. |
| | """ |
| | if from_url: |
| | _texto = str("URL") |
| | elif from_pdf: |
| | _texto = str("PDF") |
| | else: |
| | _texto = str("Ninguna opción seleccionada") |
| | return _texto |