Skip to content

Fixed for new Login Mechinism #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions pygodaddy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def is_loggedin(self, html=None):
"""
if html is None:
html = self.session.get(self.default_url).text
self.logged_in = bool(re.compile(r'Welcome:&nbsp;<span id="ctl00_lblUser" .*?\>(.*)</span>').search(html))
# I also changed the way it checks if you're logged in.
self.logged_in = bool(re.compile(r'id="menu-customer-name">(.*)</a>').search(html))
return self.logged_in


Expand All @@ -97,20 +98,16 @@ def login(self, username, password):
:returns: `True` if login is successful, else `False`
"""
r = self.session.get(self.default_url)
try:
viewstate = re.compile(r'id="__VIEWSTATE" value="([^"]+)"').search(r.text).group(1)
except:
logger.exception('Login routine broken, godaddy may have updated their login mechanism')
return False
data = {
'Login$userEntryPanel2$LoginImageButton.x' : 0,
'Login$userEntryPanel2$LoginImageButton.y' : 0,
'Login$userEntryPanel2$UsernameTextBox' : username,
'Login$userEntryPanel2$PasswordTextBox' : password,
'__VIEWSTATE': viewstate,
'app' : 'mya',
'realm' : 'idp',
'name' : username,
'password' : password,
}
r = self.session.post(r.url, data=data)
return self.is_loggedin(r.text)
# Updated by Bryce Gough = URL is using AU for the region so maybe update this if you need another region.
loginUri = 'https://sso.godaddy.com/v1/?path=%2Fdefault.aspx&app=mya&regionsite=au&marketid=en-AU'
r = self.session.post(loginUri, data=data)
return self.is_loggedin(r.text)

def find_domains(self):
""" return all domains of user """
Expand Down Expand Up @@ -254,4 +251,3 @@ def _save_records(self, domain, index, record_type='A'):
logger.error('Failed to save records, has the website changed?')
return False
return True