import wmi
a = WMI().Win32_ComputerSystemProduct()[0].UUID
print(a)
from flask import Blueprint
from utils import db_connect
app = Blueprint("name", __name__, template_folder='templates')
@app.route("/")
def index():
return render_template("index.html")
@app.context_processor
def any_data_processor():
with db_connect.connect() as con:
# тут же могла быть работа с кешем/API/файловой системой и др.
....
result = ...
return dict(any_data=result)
import time
from threading import Thread
from flask import request, Flask
app = Flask(__name__)
class Compute(Thread):
def __init__(self, request):
Thread.__init__(self)
self.request = request
def run(self):
print("start")
time.sleep(5)
print(self.request)
print("done")
@app.route('/myfunc', methods=["GET", "POST"])
def myfunc():
thread_a = Compute(request.__copy__())
thread_a.start()
return "Processing in background", 200
response = vk.messages.send( chat_id = event.chat_id, attachment = "photo585191239_457239077", random_id = 0,)
print(response)
import random
random_id = random.randrange(1, 10000)
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
driver.get("http://somedomain/url_that_delays_loading")
try:
element = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.ID, "myDynamicElement"))
)
finally:
driver.quit()
class Settings(object):
def __init__(self):
self.posts = Posts()