Open snootysteppes opened 1 month ago
I can also write a prototype for this to implement boss.
I can also write a prototype for this to implement boss.
TL:DR check what's currently in my .py, write a prototype and I'll check it as soon as I can
here is your prototype: https://github.com/TzorAL/daily-random-xkcd/pull/3 thank you sir
Here are a couple of potential issues or bugs in your script:
Date Formatting in RSS: In the
pubDate
field of the RSS feed, you're using theyear
,month
, andday
attributes from the comic data, which may not always be formatted correctly for RSS. Themonth
andday
values need to be zero-padded. Consider formatting them like this:Alternatively, you can use the
datetime
library to format the date properly.Seen Comics Reset Logic: The
clear_seen_comics_if_complete
function clears the seen comics list if the count of seen comics reaches or exceeds the latest comic number. This can lead to unintended resets if the user frequently requests comics. You might want to adjust this logic to only reset if the user explicitly requests it, or implement a threshold for the maximum number of seen comics before a reset occurs.File Paths: The RSS file is saved to
docs/rss/xkcd_feed.xml
, which may not exist on all systems. You might want to check if the directory exists before trying to save the file, or create it if it doesn't:Infinite Loop on Comic Fetching: If all comics have been seen, the
fetch_random_comic
function may enter an infinite loop since it continues to fetch comics until it finds one that hasn't been seen. If the seen comics list is complete and no reset occurs, it could get stuck. You could add a safeguard to break the loop after a certain number of attempts.Network Error Handling: In
fetch_random_comic
, if there is a network error while fetching a random comic, it will retry indefinitely. You might want to add a limit on retries or a delay before retrying.Hope this is ok sir.