username = my_user_name
password = my_pwd
link = 'www.google.com' # just for instance
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
login_data = urllib.urlencode({'username' : username, 'j_password' : password})
opener.open(link, login_data)
resp = opener.open(link,login_data)
print resp.read()
< /code>
Нет никакой ошибки, однако resp.read () - это куча CSS, и в нем есть только сообщения, такие как «Вы должны войти в систему перед чтением новостей здесь». Записи: < /p>
Company:
Username:
Password:
< /code>
У меня есть все из них, но как я могу поместить все три в переменную входа в систему?cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.open(dd)
resp = opener.open(dd)
print resp.read()
< /code>
Вот распечатки: < /p>
All third party users of this website and/or data produced by the Baltic do so at their own risk. The Baltic owes no duty of care or any other obligation to any party other than the contractual obligations which it owes to its direct contractual partners.

Подробнее здесь: https://stackoverflow.com/questions/228 ... ing-python
Мобильная версия