pygodaddy icon indicating copy to clipboard operation
pygodaddy copied to clipboard

Can't seem to connect to dns.godaddy.com

Open Yveske82 opened this issue 8 years ago • 28 comments

Since 2 days now I get an error when I run pygodaddy without making any changes. I tried with a previous, working installation but even ten I keep getting the error:

Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/pygodaddy/godaddy.py", line 87, in update_dns(public_ip) File "/usr/local/lib/python2.7/dist-packages/pygodaddy/godaddy.py", line 46, in update_dns client.login(GODADDY_USERNAME, GODADDY_PASSWORD) File "/usr/local/lib/python2.7/dist-packages/pygodaddy/client.py", line 99, in login r = self.session.get(self.default_url) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 487, in get return self.request('GET', url, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 475, in request resp = self.send(prep, *_send_kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 585, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 467, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='dns.godaddy.com', port=443): Max retries exceeded with url: /default.aspx (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x762c2510>: Failed to establish a new connection: [Errno -2] Name or service not known',))

Can't seem to connect to dns.godaddy.com but I don't know if this is a godaddy issue or shoudl I be looking at my installation?

Yveske82 avatar May 21 '16 17:05 Yveske82

Yes, it also does not work for me but enough. I decided to use godaddypy and man, much better! Full automatic for all of your accounts domins and A records.. And just a few lines. Use that! :)

trkadi avatar May 21 '16 17:05 trkadi

Do I just need to pass api key and api secret in the account file?

_api_key = None _api_secret = None

Yveske82 avatar May 21 '16 18:05 Yveske82

My ipUpdater.py :))

#!/usr/bin/env python3

# Full package imports
import pif, sys

# Partial imports
from godaddypy import Client, Account

userAccount  = Account(api_key='here-comes-you-public-api-key', api_secret='here-comes-you-secret-api-key')
userClient   = Client(userAccount)
publicIP     = pif.get_public_ip('ident.me')

# Updates all domains all records
try:
    updateResult = userClient.update_ip(publicIP)
except:
    print(sys.exc_info()[1])
    sys.exit()

if updateResult is True:
    print('Update ended with no Exception.')

trkadi avatar May 21 '16 18:05 trkadi

If I try run the updater I get a no such file or directory, well kind of. Normally it should look like: bash: /usr/local/lib/python2.7/dist-packages/godaddypy/ipupdater.py : No such file or directory While now I get just: : No such file or directory But maybe I should go start an issue at godaddypy page?

Yveske82 avatar May 21 '16 18:05 Yveske82

Can you copy your script? (with removed api keys naturally)

trkadi avatar May 21 '16 18:05 trkadi

Actually just copied yours. I do have python 2.7 instead of 3

#!/usr/bin/env python

# Full package imports
import pif, sys

# Partial imports
from godaddypy import Client, Account

userAccount  = Account(api_key='****', api_secret='****')
userClient   = Client(userAccount)
publicIP     = pif.get_public_ip('ident.me')

# Updates all domains all records
try:
    updateResult = userClient.update_ip(publicIP)
except:
    print(sys.exc_info()[1])
    sys.exit()

if updateResult is True:
    print('Update ended with no Exception.')

Yveske82 avatar May 21 '16 18:05 Yveske82

Never mind, got it to work, I don't really know python. Had to add python in front of my script. It seems to work great now. You sir are a life safer. Thank you so much. It's just the same I guess as pygodaddy, just add it to a cron every 5 minutes?

PS. I know my api was visible for a minute. Already changed and deleted :)

Yveske82 avatar May 21 '16 19:05 Yveske82

Yep. :) It's faster than pygodaddy cause of API - BUT nobody should misunderstand me, pygodadd was cool and the only tool for a while.. - Welcome. ^-^

trkadi avatar May 21 '16 19:05 trkadi

Not saying anything bad about pygodaddy. It worked great for me until 2 days ago. Anyway, I'm happy I got it able to change it again pygodaddy or godaddypy. Kinda bought a domain for € 0.99 impulsive and then realized I couldn't update my ip but that's fixed. Anyway thanks a lot for your help.

Yveske82 avatar May 21 '16 19:05 Yveske82

Did you ever have the problem that your A-Record get's deleted? It happens to me once a day with this error:

Response Data: {u'message': u'One or more of the given records is invalid', u'code':
u'INVALID_RECORDS', u'errors': [u'ARECORD @ None is not a valid IP address'], u'name':
u'_Class'}

It happens to me like once a day.

Yveske82 avatar May 25 '16 13:05 Yveske82

Hmm, quite interesting.. Also happened with me. They made a change as the lilac stuff write.. but it would be ridiculous if records got deleted cause of that...

trkadi avatar May 25 '16 13:05 trkadi

Well if it happened to you as well at least I'm not alone with the issue. I made an issue at the godaddypy page so hopefully this can get resolved soon. Right now when I can't reach my web address anymore I know I have to login my godaddy account and create a new A-record. So I guess this is how it will be done for now.

Yveske82 avatar May 25 '16 14:05 Yveske82

just create an '@' record (and if you have more subdomains then also create the subdomains record.. with 0.0.0.0 and run the updater. That will solve it but yeah, migrate ourselves to godaddypy :dash: :D

trkadi avatar May 25 '16 14:05 trkadi

:D For now it will do yes but hopefully there be a fix soon. Or a way to auto create a new record

Yveske82 avatar May 25 '16 14:05 Yveske82

Take a look here Got an answer on my issue already. Just adding a piece of code to your script. Testing it now.

Yveske82 avatar May 25 '16 19:05 Yveske82

Hi, I generated my api_key and api_secret but when I client.get_domains() for testing it out godaddy returns {u'message': u'Malformed API secret', u'code': u'MALFORMED_API_SECRET', u'name': u'ApiError'}.

Has anyone seen this.

sidheshdivekar29 avatar May 26 '16 14:05 sidheshdivekar29

Is it a production api key? And:

Note: Sometimes the production API keys don't seem to work correctly. Just delete it and request another one.

trkadi avatar May 26 '16 14:05 trkadi

Yes, its production api key, we regenerated it couple of times.

sidheshdivekar29 avatar May 26 '16 14:05 sidheshdivekar29

Got it working. Between is there a way to delete an a record. I tried updating existing A record and modifying ttl to 0, but that does not delete an A record.

sidheshdivekar29 avatar May 26 '16 17:05 sidheshdivekar29

migrate ourselves to godaddypy too, Got it working, thanks a lot for your help and sharing :)

sistemaciesac avatar May 26 '16 18:05 sistemaciesac

Thanks Adam for your starter script. Updating "all" records was too aggressive for me so here's an alternative to just update a single record.

#!/usr/bin/env python3

Full package imports

import pif, sys

Partial imports

from godaddypy import Client, Account

domain = 'example.com' a_record = 'www'

userAccount = Account(api_key='Your_Key', api_secret='Your_Secret') userClient = Client(userAccount) publicIP = pif.get_public_ip('ident.me')

try: currentIP = userClient.get_record(domain, a_record, 'A') if (publicIP != currentIP["data"]): client.update_record_ip(publicIP, domain, a_record, 'A') if updateResult is True: print('Update ended with no Exception.') else: print('No DNS update needed.') except: print(sys.exc_info()[1]) sys.exit()

On 05/21/2016 01:18 PM, Ádám Török wrote:

My ipUpdater.py :))

#!/usr/bin/env python3

Full package imports

import pif, sys

Partial imports

from godaddypyimport Client, Account

userAccount= Account(api_key='here-comes-you-public-api-key',api_secret='here-comes-you-secret-api-key') userClient= Client(userAccount) publicIP= pif.get_public_ip('ident.me')

Updates all domains all records

try: updateResult= userClient.update_ip(publicIP) except: print(sys.exc_info()[1]) sys.exit()

if updateResultis True: print('Update ended with no Exception.')

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/observerss/pygodaddy/issues/22#issuecomment-220792794

getSurreal avatar May 30 '16 21:05 getSurreal

@getSurreal JFYI, updateResult is not defined in your script, so it will crash.

frol avatar Jun 15 '16 10:06 frol

thanks @frol . I'm not sure I should keep pasting code here, but here's the corrected version anyhow. I guess the proper thing to do is submit a pull request to the right project with this example.

#!/usr/bin/env python3

# Full package imports
import pif, sys

# Partial imports
from godaddypy import Client, Account

domain = 'example.com'
a_record = 'www'

userAccount  = Account(api_key='Your_Key', api_secret='Your_Secret')
userClient   = Client(userAccount)
publicIP     = pif.get_public_ip('ident.me')

try:
     currentIP = userClient.get_record(domain, a_record, 'A')
     if (publicIP != currentIP["data"]):
         updateResult = userClient.update_record_ip(publicIP, domain, a_record, 'A')
         if updateResult is True:
             print('Update ended with no Exception.')
     else:
         print('No DNS update needed.')
except:
     print(sys.exc_info()[1])
     sys.exit()

getSurreal avatar Jun 15 '16 19:06 getSurreal

@getSurreal I tried the above code and it didn't work for me I had to change a couple of things. Those were:

  1. userClient.get_record(domain, a_record, 'A') should be userClient.get_records(domain, 'A', a_record)
  2. publicIP != currentIP["data"] should be publicIP != currentIP[0]['data']

artoleus avatar Jun 22 '16 10:06 artoleus

@artoleus Thanks for reply. It's working for me as is.

  1. Your correction is not the correct syntax. See function below
def update_record_ip(self, ip, domain, name, record_type):
        """Update the IP address for a single record
        ip -- the new IP for the DNS record (ex. '123.1.2.255')
        domain -- the domain where the DNS belongs to (ex. 'example.com')
        name -- the DNS record name to be updated (ex. 'dynamic')
        record_type -- Record type (ex. 'CNAME', 'A'...)
  1. My 'publicIP' does not come back as an array, but could be helpful for others.

getSurreal avatar Jun 22 '16 14:06 getSurreal

@getSurreal Not sure how it is working, are you using an older version?:

  1. It is the correct syntax if you are looking at the right function try looking at "get_records" as I discussed. Also there is no function called "get_record."
    def get_records(self, domain, record_type=None, name=None):

Although your code is similar to the example given in the example folder you will see that he has specified name=a_record, record_type='A' in the call to that function so position in that case doesn't matter. If you don't specify the type of entry then position becomes relevant.

  1. neither does mine. It is accessing currentIP that is the issue. If you look at his example again you will see has used for records in records to get to the ["data"] record to load CurrentIP, which gives the same result as my suggestion

see his example below:

#!/usr/bin/env python3

# Full package imports
import sys

import pif
# Partial imports
from godaddypy import Client, Account

domain = 'example.com'
a_record = 'www'

userAccount = Account(api_key='YOUR_KEY', api_secret='YOUR_SECRET')
userClient = Client(userAccount)
publicIP = pif.get_public_ip('ident.me')

try:
    records = userClient.get_records(domain, name=a_record, record_type='A')
    for record in records:
        if publicIP != record["data"]:
            updateResult = userClient.update_record_ip(publicIP, domain, name=a_record, record_type='A')
            if updateResult is True:
                print('Update ended with no Exception.')
        else:
            print('No DNS update needed.')
except:
    print(sys.exc_info()[1])
    sys.exit()

artoleus avatar Jun 23 '16 14:06 artoleus

I've ported a similar script from using pygodaddy to godaddypy. It can update multiple domains and hostnames and also has some logging, currently it's only retrieving A records but it's pretty simple to change if you want to update a CNAME or such.

https://github.com/nightah/godaddy-dyndns

Credits to CodeCorrupt and Sascha's original script.

nightah avatar Jul 05 '16 00:07 nightah

I sure am glad I happened upon this thread. I just discovered pygodaddy a couple days ago, and I couldn't understand why I was unable to connect to dns.godaddy.com. I just installed godaddypy an hour ago, and I'm able to connect to dns.godaddy.com now and view and update A and AAAA records. The godaddypy script is great.

JeremyCanfield avatar Jan 03 '17 05:01 JeremyCanfield