def get_data(): data = [{ 'id': 'joe', 'last_updated': datetime.datetime(2014, 6, 3, 0, 0, 1, tzinfo=r.make_timezone('00:00')) }, { 'id': 'sam', 'last_updated': datetime.datetime(2014, 8, 25, 0, 0, 0, tzinfo=r.make_timezone('00:00')) }] return as_db_and_table('d', 'people', data)
def create(cls, **kwargs): name = kwargs.get('name') parent = kwargs.get('parent') creator = kwargs.get('creator') # Direct parent ID parent_id = '0' if parent is None else parent['id'] doc = { 'name': name, 'parent_id': parent_id, 'creator': creator, 'is_folder': True, 'last_index': 0, 'status': True, 'objects': None, 'date_created': datetime.now(r.make_timezone('+01:00')), 'date_modified': datetime.now(r.make_timezone('+01:00')) } res = r.table(cls._table).insert(doc).run(conn) doc['id'] = res['generated_keys'][0] if parent is not None: cls.add_object(parent, doc['id'], True) cls.tag_folder(parent, doc['id']) return doc
def __init__(self, user): assert user self._data = dumb_attrdict({ "user_id": user['id'], "first_name": user['first_name'], "origin": None, "destination": None, "status": MASTER, "time": None, "options": None, "selected_option": None, "type": None, "started_at": dt.datetime.now(r.make_timezone("00:00")), "accessed_at": dt.datetime.now(r.make_timezone("00:00")), "current_msg": None, "closed": False, "confirmed": False, }) self.remaining_allowance = 0
def create(cls, **kwargs): name = kwargs.get('name') size = kwargs.get('size') uri = kwargs.get('uri') parent = kwargs.get('parent') creator = kwargs.get('creator') siteName = kwargs.get('siteName') url = kwargs.get('url') # Direct parent ID parent_id = '0' if parent is None else parent['id'] doc = { 'name': name, 'size': size, 'uri': uri, 'siteName': siteName, 'url': url, 'parent_id': parent_id, 'creator': creator, 'is_folder': False, 'status': True, 'date_created': datetime.now(r.make_timezone('+01:00')), 'date_modified': datetime.now(r.make_timezone('+01:00')) } res = r.table(cls._table).insert(doc).run(conn) doc['id'] = res['generated_keys'][0] if parent is not None: Folder.add_object(parent, doc['id']) return doc
def test_date(self, conn): expected = set([ datetime.datetime(2014, 8, 25, tzinfo=r.make_timezone('00:00')), datetime.datetime(2014, 6, 3, tzinfo=r.make_timezone('00:00')) ]) result = r.db('d').table('people').map( lambda doc: doc['last_updated'].date()).run(conn) assertEqual(expected, set(list(result)))
def test_date(self, conn): expected = set([ datetime.datetime(2014, 8, 25, tzinfo=r.make_timezone('00:00')), datetime.datetime(2014, 6, 3, tzinfo=r.make_timezone('00:00')) ]) result = r.db('d').table('people').map( lambda doc: doc['last_updated'].date() ).run(conn) assertEqual(expected, set(list(result)))
def create(cls, **kwargs): totalnodes = kwargs.get('totalnodes') doc = { 'totalnodes': totalnodes, 'date_created': datetime.now(r.make_timezone('+01:00')), 'date_modified': datetime.now(r.make_timezone('+01:00')), } print(doc) r.table(cls._table).insert(doc).run(conn)
def create(cls, **kwargs): fullname = kwargs.get('fullname') email = kwargs.get('email') password = kwargs.get('password') password_conf = kwargs.get('password_conf') if password != password_conf: raise ValidationError("Password and Confirm Password need to be the same value") password = cls.hash_password(password) doc = { 'fullname': fullname, 'email': email, 'password': password, 'date_created': datetime.now(r.make_timezone('+01:00')), 'date_modified': datetime.now(r.make_timezone('+01:00')) } r.table(cls._table).insert(doc).run(conn)
def create_chat(): data = json.loads(request.data) data['created'] = datetime.now(r.make_timezone('00:00')) if data.get('name') and data.get('message'): new_chat = r.table("chats").insert([ data ]).run(g.db_conn) return make_response('success!', 201) return make_response('invalid chat', 401)
def parse_duration(duration: str) -> datetime: """ Parses a string like '3w' into a datetime 3 weeks from now. Also supports strings like 1w2d or 1h25m. This function is adapted from a bot called ROWBOAT, written by b1naryth1ef. See https://github.com/b1naryth1ef/rowboat/blob/master/rowboat/util/input.py :param duration: a string containing the number and a time unit shorthand. :return: A datetime representing now + the duration """ if not duration: raise ValueError("No duration provided.") value = 0 digits = '' for char in duration: # Add all numbers to the digits string if char.isdigit(): digits += char continue # If it's not a number and not one of the letters in UNITS, it must be invalid. if char not in UNITS or not digits: raise ValueError("Invalid duration") # Otherwise, call the corresponding lambda to convert the value, and keep iterating. value += UNITS[char](int(digits)) digits = '' return datetime.now(make_timezone("00:00")) + timedelta(seconds=value + 1)
def transform_mongo_doc_to_rethink_doc(mdoc): for k, v in mdoc.items(): print("k: " + str(k) + " type: " + str(type(v))) ## fix subdocuments if type(v) == dict: mdoc[k] = transform_mongo_doc_to_rethink_doc(v) ## fix timezone, set to UTC ## RethinkDB will not accept dates without a timezone. ## # TODO fix to check for an existing timezone before overwriting with UTC if type(v) == datetime.datetime: mdoc[k] = v.replace(tzinfo=r.make_timezone("0:00")) ## fix object id if k == "_id": mdoc[k] = str(v) if type(v) == bson.objectid.ObjectId: mdoc[k] = str(v) if type(v) == list: mdoc[k] = [str(x) for x in v] # ## fix object id # if k == "_id": # mdoc[k] = str(v) # if k == "_etag": # mdoc[k] = str(v) return mdoc
def get_publish_date(html): found_date = htmldate.find_date(html) if found_date: return datetime.strptime(htmldate.find_date(html), '%Y-%m-%d').astimezone( r.make_timezone(PH_TIMEZONE)) return None
def transform_mongo_doc_to_rethink_doc(mdoc): for k, v in mdoc.items(): print("k: " + str(k) + " type: " + str(type(v))) ## fix subdocuments if (type(v) == dict): mdoc[k] = transform_mongo_doc_to_rethink_doc(v) ## fix timezone, set to UTC ## RethinkDB will not accept dates without a timezone. ## # TODO fix to check for an existing timezone before overwriting with UTC if (type(v) == datetime.datetime): mdoc[k] = v.replace(tzinfo=r.make_timezone('0:00')) ## fix object id if k == "_id": mdoc[k] = str(v) if (type(v) == bson.objectid.ObjectId): mdoc[k] = str(v) if (type(v) == list): mdoc[k] = [str(x) for x in v] # ## fix object id # if k == "_id": # mdoc[k] = str(v) # if k == "_etag": # mdoc[k] = str(v) return (mdoc)
def create_chat(data): data = json.loads(data) action = data['0'] conn = yield r.connect(host="localhost", port=28015, db='pyBOT') if action == "start bot": data['action'] = "start" data['status'] = 1 new_action = yield r.table("botActions").insert([data]).run(conn) print("starting bot") elif action == "exit bot": data['action'] = "stop" data['status'] = 1 new_action = yield r.table("botActions").insert([data]).run(conn) print("shutdown bot") elif action == "new message": data = data["1"] #data['created'] = datetime.now(r.make_timezone('00:00')) data['ins'] = datetime.now(r.make_timezone('00:00')) if data.get('name') and data.get('message'): new_chat = yield r.table("botChat").insert([data]).run(conn) print(">>> end create_chat")
def new_usuario(self, data): """ Método que cria um usuário com os dados informados. """ data['criado_em'] = r.expr(datetime.now( r.make_timezone(config('TIMEZONE', default='-03:00')))) return self.insert(data)
def create(cls, **kwargs): fullname = kwargs.get('fullname') email = kwargs.get('email') password = kwargs.get('password') password_conf = kwargs.get('password_conf') street_number = kwargs.get('street_number') route = kwargs.get('route') locality = kwargs.get('locality') postal_town = kwargs.get('postal_town') administrative_area_level_2 = kwargs.get('administrative_area_level_2') administrative_area_level_1 = kwargs.get('administrative_area_level_1') country = kwargs.get('country') postal_code = kwargs.get('postal_code') ocp_admin = kwargs.get('ocp_admin') if password != password_conf: raise ValidationError( "Password and Confirm password need to be the same value") password = cls.hash_password(password) doc = { 'fullname': fullname, 'email': email, 'password': password, 'ocp_admin': ocp_admin, 'address': { 'street_number': street_number, 'route': route, 'locality': locality, 'postal_town': postal_town, 'administrative_area_level_2': administrative_area_level_2, 'administrative_area_level_1': administrative_area_level_1, 'country': country, 'postal_code': postal_code }, 'date_created': datetime.now(r.make_timezone('+01:00')), 'date_modified': datetime.now(r.make_timezone('+01:00')), } print(doc) users = list(r.table(cls._table).filter({'email': email}).run(conn)) if len(users): raise ValidationError( "Could already exists with e-mail address: {0}".format(email)) r.table(cls._table).insert(doc).run(conn)
def test_epoch_time(self, conn): results = r.db('d').table('people').map(lambda d: d.merge( {'as_epoch': d['last_updated'].to_epoch_time()})).run(conn) results = list(results) jan1 = datetime.datetime(1970, 1, 1, tzinfo=r.make_timezone('00:00')) for doc in results: expected = int((doc['last_updated'] - jan1).total_seconds()) assertEqual(expected, doc['as_epoch'])
def make_time(year, month, day, hour=0, minute=0, second=0, timezone=None): timezone = timezone or rethinkdb.make_timezone('00:00') return datetime.datetime(year, month, day, hour, minute, second, tzinfo=timezone)
def test_epoch_time(self, conn): results = r.db('d').table('people').map( lambda d: d.merge({'as_epoch': d['last_updated'].to_epoch_time()}) ).run(conn) results = list(results) jan1 = datetime.datetime(1970, 1, 1, tzinfo=r.make_timezone('00:00')) for doc in results: expected = int((doc['last_updated'] - jan1).total_seconds()) assertEqual(expected, doc['as_epoch'])
def ins(): """Insert a new chat""" global n n = n + 1 data = { 'name': 'RethinkDB', 'message': '(%d .-) FROM SERVER' % n, 'created': str(datetime.now(r.make_timezone('00:00'))) } new_chat = r.table("chats").insert([data]).run(conn)
def is_expired(rdb_datetime: datetime) -> bool: """ Takes a rethinkdb datetime (timezone aware) and figures out if it has expired yet. Always compares with UTC 00:00 :param rdb_timestamp: A datetime as stored in rethinkdb. :return: True if the datetime is in the past. """ return datetime.now(make_timezone("00:00")) > rdb_datetime
def test_to_date(self): timezone = rethinkdb.make_timezone('00:00') dt = datetime.datetime(2014, 6, 3, 12, 5, 36, tzinfo=timezone) as_date = rtime.to_date(dt) assertEqual(2014, as_date.year) assertEqual(6, as_date.month) assertEqual(3, as_date.day) assertEqual(0, as_date.hour) assertEqual(0, as_date.minute) assertEqual(0, as_date.second) assertEqual(timezone, as_date.tzinfo)
def work_forever(self): conn = FailoverConnection(self.opts["hosts"]) T = R.table(self.opts["table"]) # Create the table existing_tables = R.db(self.opts["db"]).table_list().run(conn) if self.opts["table"] not in existing_tables: logging.info("Creating table %s within db %s", self.opts["table"], self.opts["db"]) R.db(self.opts["db"]).table_create(self.opts["table"]).run(conn) #=============================== # FEEDER if self.opts["feeder"]: insert_delay = 1.0 / self.opts["rate_hz"] logging.info("Starting feeder with insert rate %s jobs/sec", self.opts["rate_hz"]) while True: # Wait until we need to send the next message next_message = time.time() + insert_delay while time.time() < next_message: time.sleep(min(0.1, insert_delay)) try: job_uid = str(uuid.uuid4()) logging.debug("Publishing job %s", job_uid) T.insert({ "timestamp": datetime.now( R.make_timezone("00:00") ), # datetime objects in Rethink *MUST* contains timezone information "job_uid": job_uid, "state": self.opts["input_state"] }).run(conn) logging.debug("Published job %s", job_uid) except R.errors.ReqlOpFailedError, e: logging.exception( "Encountered ReqlOpFailedError, job has not been inserted" ) # this logic simply skips the job...but obviously in some scenarios you would # want to continue to try and reinsert the job continue try: # See how many are pending pending = T.filter(R.row['state'] == self. opts["input_state"]).count().run(conn) logging.info("There are %s jobs pending", pending) except R.errors.ReqlOpFailedError, e: logging.exception( "Encountered ReqlOpFailedError counting pending")
def new_marcador(self, **kwargs): """ Método que adiciona um novo marcador para o usuário fornecido através do ID. """ data = { 'usuario_id': kwargs.pop('usuario_id', None), 'criado_em': r.expr(datetime.now(r.make_timezone( config('TIMEZONE', default='-03:00')))) } data.update(kwargs) return self.insert(data)
def _save_time(self, type_, payload): if type_ in ('message'): value = payload[type_]['text'] cal = parsedatetime.Calendar() dt_, _ = cal.parseDT(value, tzinfo=r.make_timezone("00:00")) assert dt_ self.set('time', dt_) return True, ( 'Perfect %s! I have got all the information I need. Give me a ' 'second to find some options for you.' % (self.get('first_name'))) else: return False, m.MISSED
def stopTimer(self): self.tock = datetime.now() diff = self.tock - self.tick print(self._testMethodName, ": ", diff, "s") if self.automateTest: r.connect("localhost", 28015).repl() r.table('rabbits').insert({ "testMethodName": self._testMethodName, "testName": self.__class__.__name__, "testDurationMiliSec": diff.seconds, "timestamp": datetime.now(r.make_timezone('00:00')), }).run()
def prepare_value(cls, value): """Ensures that a value can be written to the database.""" if isinstance(value, datetime): return value.replace(tzinfo=r.make_timezone("+00:00")) if hasattr(value, "to_dict"): value = value.to_dict() if isinstance(value, dict): return cls._prepare_dict(value) if isinstance(value, (set, tuple, list)): return [cls.prepare_value(item) for item in value] elif not isinstance( value, (basestring, int, float, long, bool)) and value is not None: raise ValueError("Values must either implement to_dict, or be of" "type dict, set, tuple, list, basestring, int, " "float, long, datetime or None, got %s: %s" % (type(value), value)) return value
def create_new_incident(app_name, config): incident = Incident() incident.start_date = datetime.datetime.now(r.make_timezone('-07:00')) incident.resolved_date = None incident.status = 'Identified' # should be an enum-type thing incident.name = "{today_format}-{app_name}"\ .format(today_format=incident.start_date.strftime("%Y-%m-%d"), app_name=app_name) incident.app = app_name incident.severity = None # should be another enum-like thing incident.slack_channel = None incident.description = None incident.steps = [] incident.leader = None incident.config = config incident.resolved = False # todo: add rest of attributes from planning session # todo: needs some database saving stuff return incident
def _save_time(self, type_, payload): if type_ in ('message'): value = payload[type_]['text'] cal = parsedatetime.Calendar() dt_, _ = cal.parseDT( value, tzinfo=r.make_timezone("00:00") ) assert dt_ self.set('time', dt_) return True, ( 'Perfect %s! I have got all the information I need. Give me a ' 'second to find some options for you.' % ( self.get('first_name') ) ) else: return False, m.MISSED
def main(args): with r.connect(host=DB_HOST, port=DB_PORT, db=DB_DB).repl() as conn: today = datetime.now(r.make_timezone(TIMEZONE)) delta = today - timedelta(days=DAYS_AGO) # map: seasons with episodes that aired within a timedelta, merged with series ID and name # reduce: list concatenation series = r.table('series').map( lambda series: series['seasons'].filter( lambda season: season['episodes'].filter( lambda ep: r.iso8601(ep['airdate'], default_timezone=TIMEZONE).during(delta, today) ).count().gt(0) ).pluck('season_number').merge(series.pluck('series_id', 'series_name')) ).reduce(lambda a, b: a + b).run() if len(series) < 1: print("No current series in database") for s in series: pick_cherries(s['series_id'], s['season_number'], outdb='{}:{}/{}'.format(DB_HOST, DB_PORT, DB_DB))
def db_setup(file_name, host='localhost', port='28015', connection=None): """ Create DB and table if they don't exist, then insert jobs The database_module needs to be running and the host variable should be configured to the local host. For standard Docker installations, 'localhost' should work. :param file_name: File name where data is stored :type file_name: str :param host: RethinkDB host :type host: str :param port: RethinkDB port :type port: str :param connection: RethinkDB connection :type connection: rethinkdb.net.ConnectionInstance """ database = 'datasets' prepared_jobs_table = 'jobs_optimized' if connection is None: connection = rdb.connect(host, port) try: if not rdb.db_list().contains(database).run(connection): rdb.db_create(database).run(connection) if not rdb.db(database).table_list().contains(prepared_jobs_table).run( connection): rdb.db(database).table_create(prepared_jobs_table).run(connection) data_frame = prepare_data(file_name) data_frame.date_created = data_frame.date_created.apply( lambda time: time.to_pydatetime().replace( tzinfo=rdb.make_timezone("+02:00"))) data_frame.feedback_for_client.fillna(-1, inplace=True) data_frame.feedback_for_freelancer.fillna(-1, inplace=True) data_frame['id'] = data_frame.index rdb.db(database).table(prepared_jobs_table).insert( data_frame.to_dict('records'), conflict="replace").run(connection) except RqlRuntimeError as e: print 'Database error: {}'.format(e) return connection
def webhook_post(): data = json.loads(request.data.decode('utf-8')) entries = data['entry'] if not entries: return "", 200 for entry in entries: id_ = entry['id'] seen = r.table('seen_entries').get(id_).run(g.db) if seen: logger.warning('Duplicate receive for entry %s' % id_) messages = entry['messaging'] for msg in messages: handle(msg, g.db) seen = r.table('seen_entries').insert({ 'id': id_, 'time': dt.datetime.now(r.make_timezone("00:00")) }).run(g.db) return "", 200
def get(self): print payload = json.loads(self.get_argument('payload')) print 'payload', payload results = handle_query(payload) conn = r.connect("localhost", 28015).repl() r.db('public').table('queries').insert({ 'ip_address': self.request.headers.get("X-Forwarded-For"), 'datetime': r.expr(datetime.now(r.make_timezone('-07:00'))), 'payload': payload }).run(conn, noreply=True) print results self.set_header("Access-Control-Allow-Origin", "*") self.set_header( "Access-Control-Allow-Headers", "accept, cache-control, origin, x-requested-with, x-file-name, content-type" ) self.set_header("Content-Type", 'application/json') self.write(json.dumps(results))
def access(self): self._data.accessed_at = dt.datetime.now(r.make_timezone("00:00"))
def now(): dtime = datetime.datetime.now() return dtime.replace(tzinfo=rethinkdb.make_timezone('00:00'))
def create_rql_timezone(timezone_string): if timezone_string == 'Z': return rethinkdb.make_timezone('00:00') else: raise NotImplementedError
def __init__(self, initial_data): self._modify_initial_data(initial_data) self.tzinfo = rethinkdb.make_timezone('00:00')
from scipy.stats import bernoulli import db as d import json import ast import time import random from datetime import datetime import rethinkdb as r from main import product as product r.db_create('test3').run() timezone = time.strftime("%z") tz = r.make_timezone(timezone[:3] + ":" + timezone[3:]) Date = datetime.now(tz) timestamp = time.mktime(Date.timetuple()) json_date = Date.isoformat() def compute(): for x in xrange(200): p = product() random.normalvariate(random.randrange(500, 1050, 100), random.randrange(50, 105, 10)) # call to database to get inventory for this product at this time p.inventory.cur = random.randrange( random.randrange(1 + (x % 20), 10 + (x % 20), 2),
def get_dt(): return r.expr(datetime.now(r.make_timezone('-07:00')))
def get_data(): data = [ {'id': 'joe', 'last_updated': datetime.datetime(2014, 6, 3, 0, 0, 1, tzinfo=r.make_timezone('00:00'))}, {'id': 'sam', 'last_updated': datetime.datetime(2014, 8, 25, 0, 0, 0, tzinfo=r.make_timezone('00:00'))} ] return as_db_and_table('d', 'people', data)
limitations under the License. ''' import rethinkdb as r import logging import random import time import types import socket import os import datetime try: UTC = datetime.timezone.utc except: UTC = r.make_timezone("00:00") def utcnow(): """Convenience function to get timezone-aware UTC datetime. RethinkDB requires timezone-aware datetime for its native time type, and unfortunately datetime.datetime.utcnow() is not timezone-aware. Also python 2 doesn't come with a timezone implementation.""" return datetime.datetime.now(UTC) class RethinkerWrapper(object): logger = logging.getLogger('rethinkstuff.RethinkerWrapper') def __init__(self, rethinker, wrapped): self.rethinker = rethinker self.wrapped = wrapped def __getattr__(self, name):
logging.info(MODULE_NAME+": Successful DB connection") logging.info(MODULE_NAME+": Checking if db %s exists",DB_NAME) if DB_NAME not in list(r.db_list().run(conn)): logging.info(MODULE_NAME+"db does not exist, creating...") r.db_create(DB_NAME).run(conn) logging.info(MODULE_NAME+": db exists") logging.info(MODULE_NAME+": Checking to see if table %s exists",'observations') if 'observations' not in list(r.table_list().run(conn)): logging.info(MODULE_NAME+": table does not exist, creating...") r.table_create("observations").run(conn) logging.info(MODULE_NAME+": table exists") timezone = time.strftime("%z") reql_tz = r.make_timezone(timezone[:3] + ":" + timezone[3:]) # measure pressure bmp = BMP_Adapter(350,'p_0001') d_pressure = bmp.readJSON() #print(d_pressure) #measure temperature sensor 1 soil_temperature = DS18B20_Adapter('t_0001','28-04165b7853ff') d_temp1 = soil_temperature.readJSON() #print(d_temp1) #measure temperature sensor 2 outside_temperature = DS18B20_Adapter('t_0002','28-0316603aefff')
conn = r.connect(db="demomodel", host=sjbsettings.sjb["MHOST"]).repl() for pred in r.table("prediction").run(conn): print(pred) # In[47]: seen_keys = {} # In[68]: insert_into_rethink = True while 1: for pred in preds.find(): pid = pred["_id"] if pid not in list(seen_keys.keys()): # print(str(pred) + " is new!") # print(str(r.iso8601(pred['update_t']))) ## pred['update_t'] = r.make_timezone(pred['update_t']) pred["_id"] = str(pred["_id"]) pred["update_t"] = pred["update_t"].replace(tzinfo=r.make_timezone("0:00")) print("Updating " + pred["uid"] + " at " + str(pred["update_t"])) if insert_into_rethink: seen_keys[pid] = True r.table("prediction").insert(pred).run(conn) time.sleep(0.1)
print(pred) # In[47]: seen_keys = {} # In[68]: insert_into_rethink = True while 1: for pred in preds.find(): pid = pred['_id'] if pid not in list(seen_keys.keys()): # print(str(pred) + " is new!") # print(str(r.iso8601(pred['update_t']))) ## pred['update_t'] = r.make_timezone(pred['update_t']) pred['_id'] = str(pred['_id']) pred['update_t'] = pred['update_t'].replace(tzinfo=r.make_timezone('0:00')) print("Updating " + pred['uid'] + " at " + str(pred['update_t'])) if insert_into_rethink: seen_keys[pid] = True r.table('prediction').insert(pred).run(conn) time.sleep(0.1)
def get(self): print payload = json.loads(self.get_argument('payload')) print 'payload', payload results = handle_query(payload) conn = r.connect( "localhost", 28015).repl() r.db('public').table('queries').insert({'ip_address': self.request.headers.get("X-Forwarded-For"), 'datetime': r.expr(datetime.now(r.make_timezone('-07:00'))), 'payload': payload}).run(conn, noreply=True) print results self.set_header("Access-Control-Allow-Origin", "*") self.set_header("Access-Control-Allow-Headers", "accept, cache-control, origin, x-requested-with, x-file-name, content-type") self.set_header("Content-Type", 'application/json') self.write(json.dumps(results))
import datetime import hashlib import logging import re import uuid import tornado.gen import rethinkdb as r import utils r.connect('localhost', 28015).repl() db = r.db('nohuck') utc = r.make_timezone('00:00') ### Settings ### def settings_create(): #db.table_create('settings').run() settings = { 'id': 'settings', 'motd': 'welcome to nohuck!', 'about': 'https://github.com/csytan/nohuck', 'cookie_secret': str(uuid.uuid4()), 'youtube_api_key': None } id_counter = { 'id': 'id_counter', 'value': 4044
def novo_login(self): """ Método que realiza o login e salva a data em que o usuário o realizou. """ return self.update({'ultimo_login': r.expr(datetime.now( r.make_timezone(config('TIMEZONE', default='-03:00'))))})