Skip to content

Commit

Permalink
Moved headers configuration to session object
Browse files Browse the repository at this point in the history
  • Loading branch information
PLanB2008 committed Jun 4, 2024
1 parent 797183e commit 2b83c8e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 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 @@ -119,9 +120,8 @@ def login(
# request session id
self.http_session.get(self.api_url)
data={'identifier': username, 'passwd': password, 'action_customer_login.x': 'Login'}
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:126.0) Gecko/20100101 Firefox/126.0'}

request = self.http_session.post(self.api_url, headers=headers, data=data)
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 2b83c8e

Please sign in to comment.