value = 'ABCDEFG'
s = requests.Session()
s.get('https://server.ru')
aaa_cookie_val1 = {"name": 'val1', "value": value, "domain":' .aaa.server.ru',}
aaa_cookie_val2 = {"name": 'val2', "value": value, "domain": '.aaa.server.ru',}
bbb_cookie_val1 = {"name": 'val1', "value": value, "domain": '.bbb.server.ru',}
bbb_cookie_val2 = {"name": 'val2', "value": value, "domain": '.bbb.server.ru',}
s.cookies.set(**aaa_cookie_val1)
s.cookies.set(**aaa_cookie_val2)
s.cookies.set(**bbb_cookie_val1)
s.cookies.set(**bbb_cookie_val2)
s.get('https://server.ru/login?login=%s&password=%s' % (login, password))
value='ABCDEFG'
vals=['val1','val2']
domains=['.aaa','.bbb']
import itertools
for val,domain in itertools.product(vals,domains):
cookie_val={"name": val, "value": value, "domain":"%s.server.ru"%domain,}
print cookie_val
{'domain': '.aaa.server.ru', 'name': 'val1', 'value': 'ABCDEFG'}
{'domain': '.bbb.server.ru', 'name': 'val1', 'value': 'ABCDEFG'}
{'domain': '.aaa.server.ru', 'name': 'val2', 'value': 'ABCDEFG'}
{'domain': '.bbb.server.ru', 'name': 'val2', 'value': 'ABCDEFG'}
s.cookies.set(**cookie_val)
и уже вне цикла вызвать s.get('https://server.ru/login?login=%s&password=%s' % (login, password))
import itertools
value = 'ABCDEFG'
s = requests.Session()
s.get('https://server.ru')
for val,domain in itertools.product(['val1','val2'],['.aaa','.bbb']):
cookie_val={"name": val, "value": value, "domain":"%s.server.ru"%domain,}
s.cookies.set(**cookie_val)
s.get('https://server.ru/login?login=%s&password=%s' % (login, password))