Parcourir la source

Update 'run.py'

master
TheBidouilleur il y a 7 mois
Parent
révision
63341802b8
1 fichiers modifiés avec 13 ajouts et 10 suppressions
  1. +13
    -10
      run.py

advice.py → run.py Voir le fichier

@@ -1,5 +1,6 @@
import requests
from config import advice_api
from twitter import tweet
import time

def fetch_advice():
@@ -17,18 +18,20 @@ def create_file(message):
write_file.write(message)

def main():
t = time.localtime()
current_time = int(time.strftime("%H", t))
print("it's : ",current_time)
while current_time != 23 :
while True :
t = time.localtime()
current_time = int(time.strftime("%H", t))
print("it's : ",current_time)
while current_time != 23 :
current_time = int(time.strftime("%H", t))
time.sleep(600)
advice = fetch_advice()
print(advice)
tweet(advice)
create_file(advice)
t = time.localtime()
current_time = time.strftime("%H", t)
time.sleep(3600)
advice = fetch_advice()
print(advice)
create_file(advice)
t = time.localtime()
current_time = time.strftime("%H", t)
time.sleep(3600)

if __name__ == '__main__':
try :

Chargement…
Annuler
Enregistrer