Мне нужен скрипт, который регистрирует меня в моей учетной записи git hub и открывает страницу github в браузере. До сих пор он получает доступ только с BeautifulSoup. Мне нужно открыть веб-страницу с моей учетной записью.
Спасибо
import requests
from bs4 import BeautifulSoup as bs
import webbrowser
from urllib.request import urlopen
login_data = {
'commit': 'Sign in',
'utf8': '✓',
'authenticity_token': 'willchange',
'login': 'maximmashkov',
'password': '12345',
'webauthn-support' : 'supported'
}
headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'
}
with requests.Session() as s:
url = 'https://github.com/session'
r = s.get(url, headers=headers)
soup = bs(r.content, 'html5lib')
login_data['authenticity_token'] = soup.find('input', attrs = {'name': 'authenticity_token'})['value']
response = requests.get(url)
r = s.post(url, data=login_data, headers=headers)