I'm trying to login github using python requests. In the login page, I find I need the following data to post to server.
commit: Sign in
authenticity_token: 3YV9FG87QiYCga1Ue3IGMRSh88uDWBBhVW2Plwd22uDe+CBPbK/n+I+TC0ozTBsvk7QEPjNdFLvCil/9mdMr5A== ga_id: 642223273.1583769258
login: XXX
password: XXX
webauthn-support: supported
webauthn-iuvpaa-support: unsupported
return_to:
required_field_57c4:
timestamp: 1583770320678
timestamp_secret: fdc0b523bcd384d633c714f78fc8fd5d909dde3a05c0501345f358af2890fdec
I can get 'ga_id' from login page using chrome, but when I use python request to get login page.html, I found it's content is blank.
The following data was getting by chrome:
meta name="octolytics-dimension-ga_id" content="740927323.1583770634" class="js-octo-ga-id"
while when I use python requests, I got data like this, but the content is blank.
meta name="octolytics-dimension-ga_id" content="" class="js-octo-ga-id"
import requests
import re
def login():
headers = {
'Referer': 'https://github.com/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36',
'Host': 'github.com',
}
url1 = "https://github.com/login"
response = session.get(url1, headers=headers).content
print(response)
When I print response, I found the "octolytics-dimension-ga_id" content is blank. Why?