forked from S1M0N38/soccerapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
34 lines (25 loc) · 1022 Bytes
/
conftest.py
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
34
# import os
import requests
def pytest_addoption(parser):
parser.addoption("--ip", action="store_true")
# parser.addoption("--proxy", action="store_true")
def pytest_sessionstart(session):
if session.config.option.ip:
ip_info()
# if session.config.option.proxy:
# config_proxy()
def ip_info():
url = 'https://wtfismyip.com/json'
info = requests.get(url).json()
print(f'ip address: {info["YourFuckingIPAddress"]}')
print(f'location: {info["YourFuckingLocation"]}')
print(f'hostname: {info["YourFuckingHostname"]}')
print(f'ips: {info["YourFuckingISP"]}')
print(f'country code: {info["YourFuckingCountryCode"]}')
# def config_proxy():
# if os.getenv('HTTP_PROXY') is None:
# proxy = os.environ['PROXY']
# username = os.environ['PROXY_USERNAME']
# password = os.environ['PROXY_PASSWORD']
# os.environ['HTTPS_PROXY'] = f'http://{username}:{password}@{proxy}/'
# print('HTTPS_PROXY environment variable has been set')