Sindbad~EG File Manager
from flask import request, Blueprint, jsonify, redirect, url_for,flash, render_template,session,json,render_template_string,Response
from core.model.SyncModel import SyncModel
from core.library.email import EMAIL
from .. import Cryptography,Helper
# from flask import session, app
from random import randint
import datetime
from datetime import timedelta,date,datetime,time
import requests, json
from werkzeug.utils import secure_filename
from os.path import join, dirname, realpath
import os
import flask
import string
import webbrowser
from flask import Flask
# from Code128 import Code128
# from base64 import b64encode
from collections import defaultdict
import math
from core import app
import pytz
UTC = pytz.utc
IST = pytz.timezone('Asia/Calcutta')
datetime_ist = datetime.now(IST)
# from flask_qrcode import QRcode
app = Blueprint('sync', __name__)
@app.route('/test_sync', methods = ["GET"])
def TestSync():
return "test sync"
@app.route('/test_post_sync', methods = ["POST"])
def TestPostSync():
content_type = request.headers.get('Content-Type')
if (content_type == 'application/json'):
result = request.get_json(silent=True)
return result[0]["name"]
# return jsonify(result)
@app.route('/post_sync_table_data', methods = ["POST","GET"])
def PostSyncTableData():
print(",,,,,,,,,,,,,,,,,,,,,,,,,,")
last_new_sync_at = None
last_update_sync_at = None
now = datetime.now(IST)
current_dt = now.strftime('%Y-%m-%d %H:%M:%S')
content_type = request.headers.get('Content-Type')
hall_id = request.values.get("hall_id")
conf_id = request.values.get("conf_id")
conf_key = request.values.get("conf_key")
scan_table_name = request.values.get("scan_table_name")
conf_schema = request.values.get("conf_schema")
create_table = SyncModel().usp_generate_session_table_scan_logs_by_day(conf_id)
if (content_type == 'application/json'):
result = request.get_json(silent=True)
hall_table_data = result["hall_table_data_not_sync"]
print("-------------------- sync calls -------------------")
msg = "success"
if hall_table_data:
msg = SyncModel().insert_update_table_data_to_live(conf_id,conf_key,hall_id,hall_table_data,scan_table_name,current_dt,conf_schema)
last_sync_at = None
if msg == "success":
last_sync_at = current_dt
# data = {'last_new_sync_at':last_new_sync_at,'last_update_sync_at':current_dt}
data = {'msg':msg,'last_sync_at':last_sync_at}
print(",,,,,,,,,,,,,,,",data)
return jsonify(data)
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists