from seleniumwire import webdriver
from fake_useragent import UserAgent
from selenium.webdriver import FirefoxProfile
seleniumwire_options = {
'proxy': {
'http': f'http://'
f'{proxy_data["username"]}:{proxy_data["password"]}@'
f'{proxy_data["proxy_address"]}:{proxy_data["ports"]["socks5"]}',
'https': f'https://'
f'{proxy_data["username"]}:{proxy_data["password"]}@'
f'{proxy_data["proxy_address"]}:{proxy_data["ports"]["socks5"]}',
'no_proxy': 'localhost,127.0.0.1,dev_server:8080'
}
}
profile = FirefoxProfile()
user_agent = UserAgent().random
profile.set_preference("general.useragent.override", user_agent)
options = Options()
options.add_argument('--headless')
driver = webdriver.Firefox(
firefox_profile=profile,
options=options,
seleniumwire_options=seleniumwire_options
)
driver.get('http://<your_url>')
./manage.py runserver
from datetime import datetime
import grequests
url = "https://localhost:8000/"
count = 150 # Количество запросов
start_time = time.time()
grequests.map(grequests.get(url) for u in range(count)) # c head получается чуть больше
sending_time = time.time() - start_time
print(sending_time) # время на отправку указанного кол-ва запросов
$('#buttonID').on('click', function(){
var url = "your_view_url";
$.ajax({
type: "POST",
url: url,
data: $("form").serialize()
});
return '';
});