What do you want to save?
Add Code snippet
New code examples
-
Other 2022-01-22 09:36:12
Get a list of dates between two dates
from datetime import timedelta, date def daterange(date1, date2): for n in range(int ((date2 - date1).days)+1): yield date1 + timedelta(n) start_dt = date(2015, 12, 20) end_dt = date(2016, 1, 11) for dt in daterange(start_dt, end_dt): pr... Add solution -
Javascript 2021-11-02 15:09:12
choropleth map of india which shows current date confirmed cases in every state json api python.
import pandas as pdimport warningsimport jsonimport requestsimport numpy as npimport datetimefrom datetime import timedeltaimport seaborn as sbimport matplotlib.pyplot as plt Add solution -
Python 2021-10-24 17:55:21
flask session auto logout in 5 mins
from datetime import timedelta app = Flask(__name__) app.config['SECRET_KEY'] = 'xxxxxxxxx' app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(minutes=5) The session will created for each client, seperated from other clients. So, I think the best pl... Add solution -
Python 2021-10-18 18:52:12
https://docs.djangoproject.com/en/dev/topics/signing/#django.core.signing.Signer
from datetime import timedelta from django.core.signing import TimestampSigner signer = TimestampSigner() value = signer.sign('hello') value signer.unsign(value) signer.unsign(value, max_age=10) signer.unsign(value, max_age=20) signer.unsign(value, max... Add solution