solesensei/notion-game-list

Datetime parsing error

rexwangcc opened this issue · 2 comments

Thank you for making such a good tool :p

I was trying to generate a list but got the following error:

...
Creating Notion template page...
Created!
Importing steam library games to Notion...
ValueError: time data 'Dec 13, 2013' does not match format '%b %Y'

I believe that was due to the datetime format mismatch (or perhaps steam changed the format of the game dates), for example, in my game_info_cache.json, games are shown like:

{"id": "251570", "name": "7 Days to Die", "platforms": ["steam"], "release_date": "Dec 13, 2013", "playtime": "56 minutes", "logo_uri": "https://steamcdn-a.akamaihd.net/steam/apps/251570/header.jpg?t=1599069217", "bg_uri": "https://steamcdn-a.akamaihd.net/steam/apps/251570/page.bg.jpg", "icon_uri": "http://media.steampowered.com/steamcommunity/public/images/apps/251570/f6515dd177b2992aebcb563151fbe836a600f364.jpg", "free": false}

note in the JSON it shows Dec 13, 2013 which is equal to "%b %d, %Y" whereas

return datetime.strptime(date_str, r"%d %b, %Y").date()
assumes "%d %b, %Y".

Thank you for details, yes, you're right, date was reversed. Maybe steam changed api.
I'll fix it in next release

Check last release, feel free to reopen the issue if error persist