This commit is contained in:
Ionel Andrei Cataon
2026-02-12 15:34:02 +02:00
parent 00cf4bb992
commit 0528f7c837
2 changed files with 2 additions and 3 deletions

View File

@@ -10,4 +10,4 @@ COPY quotes.py .
# Defines o varianta de baza
ENV QUOTE_API_URL="https://api.quotable.io/random"
CMD ["python", "quotes.py"]
CMD ["python", "famousquotes.py"]

View File

@@ -2,13 +2,12 @@ import requests
import os
import sys
# URL-ul API-ului poate fi setat prin variabila de mediu QUOTE_API_URL, altfel se folosește valoarea implicită
API_URL = os.getenv("QUOTE_API_URL", "https://api.quotable.io/random")
def get_quote():
try:
response = requests.get(API_URL, timeout=10)
response.raise_for_status() # Aruncă eroare dacă statusul nu e 200
response.raise_for_status()
data = response.json()
print("-" * 30)
print(f"CITAT: {data['content']}")