version: "3.9"
services:
db:
image: postgres
restart: always
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
adminer:
image: adminer
restart: always
ports:
- '8080:8080'
$k1 = ($width / $height);
$k2 = ($source_width / $source_height);
if ($k1 > $k2) {
$w_lt = round(($width-($height*$k2))/2);
$h_lt = 0;
$w_rb = round(($height*$k2));
$h_rb = $height;
} elseif ($k1 < $k2) {
$w_lt = 0;
$h_lt = round(($height-round($width/$k2))/2);
$w_rb = $width;
$h_rb = round($width/$k2);
} else {
$w_lt = 0;
$h_lt = 0;
$w_rb = $width;
$h_rb = $height;
}
$image_modified = imagecreatetruecolor($width,$height);
if ($isPNG) {imageAlphaBlending($image_modified, false);imageSaveAlpha($image_modified, true);}
imagecopyresampled($image_modified, $image, $w_lt, $h_lt, 0, 0, $w_rb, $h_rb, $source_width, $source_height);
# https://pywebview.flowrl.com
import webview
import threading
import time
import sys
import random
html = """
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"></head><body>
<a href="" id="b1">Button</a>
<script>
document.querySelector('#b1').addEventListener('click', (ev) => {
ev.preventDefault();
pywebview.api.btnAClick().then((r) => {
document.querySelector('#b1').style.color = '#FFF000';
});
});
</script>
</body></html>
"""
class MyApi:
def __init__(self):
self.cancel_heavy_stuff_flag = False
def btnAClick(self):
response = {
'error': 0,
'message': 'https://google.com/'
}
return response
if __name__ == '__main__':
api = MyApi()
window = webview.create_window('Example', html=html, js_api=api)
webview.start()
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
@media screen and (max-width: 449px) {}
@media screen and (min-width: 450px) and (max-width: 991px) {}
@media screen and (min-width: 992px) and (max-width: 1199px) {}
@media screen and (min-width: 1200px) {}
import os, json, requests
from selenium import webdriver
from selenium.common import exceptions
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from webdriver_manager.chrome import ChromeDriverManager
if __name__ == '__main__':
options = webdriver.ChromeOptions()
options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36')
options.add_argument('--headless')
options.add_argument('--user-data-dir=/app/google-chrome')
# В моем случае, это Selenium Grid 4
driver = webdriver.Remote(command_executor=grid_url, options=options, desired_capabilities={})
driver.get("https://domain.com/some-page-with-cookies")
# Делаем авторизацию, если нужна
# ...
# Забираем куки и удаляем сессию
driver_cookies = driver.get_cookies()
driver.close()
driver.quit()
cookies = {}
for cookie in driver_cookies:
cookies[ cookie['name'] ] = cookie['value']
r = requests.get('https://domain.com/target-url', cookies=cookies)