Listing 13-08: Sites

##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 13\13.08 - Sites.py
# Description: Sites
##############################################################################

from uuid import uuid4
from datetime import date

class Site:
    def __init__(self, /, url=None, category=None, date_added=None, id=None, notes=None):
        if id is None:
            id = str(uuid4())
        self.id = id
        if date_added is None:
            date_added = date.today().strftime("%d-%m-%y")
        self.date = date_added
        self.url = url
        self.category = category
        self.notes = notes

    def __str__(self):
        return f"Site {self.id} {self.url} {self.category} {self.notes}"
Click here to download the file