Skip to content

Commit

Permalink
Merge pull request #36 from PLanB2008/master
Browse files Browse the repository at this point in the history
Fix login request, Add headers CertbotStratoApi
  • Loading branch information
Buxdehuda authored Jun 4, 2024
2 parents 0a8b431 + 2b83c8e commit dd64080
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions certbotstratoapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ def __init__(self, api_url=None):
self.domain_name = os.environ['CERTBOT_DOMAIN']
self.second_level_domain_name = re.search(r'([\w-]+\.[\w-]+)$',
self.domain_name).group(1)

print(f'INFO: txt_key: {self.txt_key}')
print(f'INFO: txt_value: {self.txt_value}')
print(f'INFO: second_level_domain_name: {self.second_level_domain_name}')
print(f'INFO: domain_name: {self.domain_name}')

# setup session for cookie sharing
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:126.0) Gecko/20100101 Firefox/126.0'}
self.http_session = requests.session()
self.http_session.headers.update(headers)

# Set later
self.session_id = ''
Expand Down Expand Up @@ -118,11 +119,9 @@ def login(
"""
# request session id
self.http_session.get(self.api_url)
request = self.http_session.post(self.api_url, {
'identifier': username,
'passwd': password,
'action_customer_login.x': 'Login'
})
data={'identifier': username, 'passwd': password, 'action_customer_login.x': 'Login'}

request = self.http_session.post(self.api_url, data=data)

# Check 2FA Login
request = self.login_2fa(request, username,
Expand Down

0 comments on commit dd64080

Please sign in to comment.