Tool
ombi_Recently_added
get ombi Recently added
Tool ID
ombi_recently_added
Downloads
26+

Tool Content
python
import requests
from pydantic import BaseModel, Field

# Define the API endpoint and API key
api_url = ""
api_key = ""

# Set up the headers with the API key
headers = {
    "ApiKey": api_key
}

# Define the model for the movie data
class Movie(BaseModel):
    title: str
    year: int

# Make the GET request to the API
response = requests.get(api_url, headers=headers)

# Check if the request was successful
if response.status_code == 200:
    # Parse the JSON response
    data = response.json()
    # Initialize a list of movies
    movie_list = []
    # Iterate over each item in the data and add it to the movie list
    for item in data:
        movie = Movie(title=item["title"], year=item["year"])
        movie_list.append(movie)
    # Print the list of movies
    print("Recently Added Movies:")
    for movie in movie_list:
        print(movie)  # Adjust this line to display relevant details from each movie
else:
    # Print an error message if the request failed
    print(f"Failed to retrieve data. Status code: {response.status_code}")
    print(response.text)  # Print the error message returned by the API