From c7cc743abb28805e1b08aa539208de216de62f3f Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 29 Apr 2020 00:05:48 +0200 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'notification.py'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notification.py | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/notification.py b/notification.py index d38c09a..0fbd5e0 100644 --- a/notification.py +++ b/notification.py @@ -5,17 +5,57 @@ import logging import requests import json -from bot import login_beta, user_id, token_bot +from bot import login_beta, user_id, token_bot, client_id +from telegram.ext import Updater, CommandHandler +#Love Is War / Une serie pour tester le programme. +thetvdb_id= '354198' + + +def create_api(choice): + if choice == 'latest' : + base_url = 'https://api.betaseries.com/episodes/latest?' + API = base_url + 'token=' + token + '&client_id=' + client_id + '&thetvdb_id=' + thetvdb_id + return API + +def check_latest(): + API = create_api('latest') + request = requests.get(API) + if str(request) != '' : + return False + show = request.json() + episode = show['episode'] + + ###Recuperation du titre + title = episode['show'] + + + print("Titre de la serie : ", str(title['title'])) + + # print("Episode : ", data[episode], " Saison : ", data[season] ) + + def main(): + global token + + token = login_beta() + print("------------------------------") print("Votre ID Telegram : ", user_id) print("Token du bot Telegram : ", token_bot) - token = login_beta() + print("Cle API de betaserie : ", client_id) print("Token betaseries : ", token) + print("------------------------------") + print("\n\t") print("Pour arreter le script : CTRL+Z") + + check_latest() # while 1 : - # print("Salut!") + # #print(démarrage boucle) + # print("Boucle") + + + print("Erreur ! Fin de la boucle")