I'm quite new to coding and stuff and i wanted to code a discord bot, that sends a message with the weekly free games. I copied the free games example from https://github.com/SD4RK/epicstore_api/tree/master/examples for that with a few changes (I try to learn it by reading other peoples codes and trying to understand it) but it always gives me games that are no longer free, but were free before. I tried different things like del free_games
or free_games.clear()
at the end of the whole function, but both didn't work. The best thing was free_games.remove(game)
at the end of the for game in free_games
part, but than it gave only the old games that are no longer free out and not the current. I hope someone can help me with that.
Edit okay here the code:
def main():
api = EpicGamesStoreAPI()
free_games = api.get_free_games()['data']['Catalog']['searchStore']['elements']
for game in free_games:
game_name = game['title']
#not important
print('{} ({}) is FREE now.'.format(game_name, game_price))