File size: 916 Bytes
e7a935e 78dfc29 e7a935e 78dfc29 e7a935e 2a83702 e7a935e 4237ab4 78dfc29 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import time
from dotenv import load_dotenv
import os
import random
load_dotenv()
PROXY_PASSWORD = os.getenv("PROXY_PASSWORD")
PROXY_USER = os.getenv("PROXY_USER")
def timer_decorator(func):
def wrapper(*args, **kwargs):
start_time = time.time()
result = func(*args, **kwargs)
end_time = time.time()
print(f"Function {func.__name__} took {end_time - start_time:.4f} seconds to execute")
return result
return wrapper
def async_timer_decorator(func):
async def wrapper(*args, **kwargs):
start_time = time.time()
result = await func(*args, **kwargs)
end_time = time.time()
print(f"Function {func.__name__} took {end_time - start_time:.4f} seconds to execute")
return result
return wrapper
def generate_proxy_url():
port = random.randint(10000,10099)
return f'http://{PROXY_USER}:{PROXY_PASSWORD}@gate.smartproxy.com:{port}'
|