using right tz for reminderlist
This commit is contained in:
parent
fd0151d2ab
commit
aec56fd0fc
1 changed files with 10 additions and 5 deletions
|
@ -1,8 +1,8 @@
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
import time
|
|
||||||
import os
|
import os
|
||||||
|
from time import time
|
||||||
from pytz import timezone
|
from pytz import timezone
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ def removeStartEndSpacesString(string):
|
||||||
|
|
||||||
def randomImage(link):
|
def randomImage(link):
|
||||||
"""Récupération d'une image aléatoirement"""
|
"""Récupération d'une image aléatoirement"""
|
||||||
temps_requete = int(round(time.time() * 1000))
|
temps_requete = int(round(time() * 1000))
|
||||||
try:
|
try:
|
||||||
request_data = requests.get(link)
|
request_data = requests.get(link)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -134,7 +134,7 @@ def randomImage(link):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(f"Erreur lors de la transformation les données de {link} en json : {e}")
|
raise Exception(f"Erreur lors de la transformation les données de {link} en json : {e}")
|
||||||
|
|
||||||
temps_requete = int(round(time.time() * 1000)) - temps_requete
|
temps_requete = int(round(time() * 1000)) - temps_requete
|
||||||
return (json_data, temps_requete)
|
return (json_data, temps_requete)
|
||||||
|
|
||||||
def retirerDoublons(liste):
|
def retirerDoublons(liste):
|
||||||
|
@ -183,6 +183,9 @@ def stringTempsVersSecondes(time):
|
||||||
def nowTimestampCustom():
|
def nowTimestampCustom():
|
||||||
return datetime.now(timezone(myTimezone)).timestamp()
|
return datetime.now(timezone(myTimezone)).timestamp()
|
||||||
|
|
||||||
|
def UTCTimestampToCustomTimestamp(timestamp):
|
||||||
|
return timezone(myTimezone).fromutc(timestamp)
|
||||||
|
|
||||||
def nowTimestampUTC():
|
def nowTimestampUTC():
|
||||||
return datetime.utcnow().timestamp()
|
return datetime.utcnow().timestamp()
|
||||||
|
|
||||||
|
@ -206,5 +209,7 @@ def timedeltaToString(time):
|
||||||
return ''.join(age)
|
return ''.join(age)
|
||||||
|
|
||||||
def timestampFR(timestamp):
|
def timestampFR(timestamp):
|
||||||
date_edit = str(timestamp).replace('-', '/').split(' ')
|
date_edit = str(UTCTimestampToCustomTimestamp(timestamp)).replace('-', '/').split(' ')
|
||||||
return f"{date_edit[0][8:]}/{date_edit[0][5:-3]}/{date_edit[0][:4]} à {date_edit[1]}"
|
date = date_edit[0]
|
||||||
|
heure = date_edit[1].split('+')[0]
|
||||||
|
return f"{date[8:]}/{date[5:-3]}/{date[:4]} à {heure}"
|
||||||
|
|
Reference in a new issue