examadeus / godaddypy Goto Github PK
View Code? Open in Web Editor NEWPython GoDaddy API Client
License: BSD 3-Clause "New" or "Revised" License
Python GoDaddy API Client
License: BSD 3-Clause "New" or "Revised" License
In function update_ip
of client.py
, the following check does not work for python 3:
if (
subdomains is None or
(isinstance(subdomains, (unicode, str)) and r_name == subdomains) or
r_name in subdomains
):
This seems a bug as the rest of the function is careful in specifying behaviours for both python 2 and python 3. That is easy to fix, the check could simply become as follows for python 3:
if (
subdomains is None or
(isinstance(subdomains, str) and r_name == subdomains) or
r_name in subdomains
):
Currently, the unit tests only get run against multiple versions of python through travis CI. It would be nice to have a local configuration (something like tox) that would run tests against a battery of different python versions so that developers can see if a test will fail in a certain version before having to push the commit and have CI catch the error.
I notice here that it seems that one should be GODADDY_API_KEY
and one should be GODADDY_API_SECRET
- is this copy pasta?
I actually have not used the package yet, I'm still surveying my options and as a part of that was glancing through the source. I can't tell you how this is or is not an actual bug or how it would manifest
Hope this is helpful, sorry if it's just spam :)
(
godaddypy/godaddypy/account.py
Lines 161 to 162 in 98683e6
how can i get all domains, i used client.get_domains() to get all doamins, but i get a little only. i find the limit args in official docmetion, but i do not know how to use... help me. think you
The library is a good idea, but adding a simple tool to add/update records would be a great one: that would avoid the need to write yet another script for simple use. For the same reason adding a simple dot file in ini/yaml format for credentials would be a nice addon, too. Just my 2 cents.
Thanks for your work on this - I'm hoping to do some things that godaddy tech support can't help me with.
Following your sample code with my apikey/secret raised an exception:
In [1]: from godaddypy import Client, Account
In [2]: my_acct = Account(api_key='...', api_secret='...')
In [3]: client = Client(my_acct)
In [4]: client.get_domains()
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
~/anaconda/lib/python3.8/site-packages/godaddypy/client.py in _validate_response_success(response)
104 try:
--> 105 response.raise_for_status()
106 except Exception:
~/anaconda/lib/python3.8/site-packages/requests/models.py in raise_for_status(self)
942 if http_error_msg:
--> 943 raise HTTPError(http_error_msg, response=self)
944
HTTPError: 401 Client Error: Unauthorized for url: https://api.godaddy.com/v1/domains
During handling of the above exception, another exception occurred:
BadResponse Traceback (most recent call last)
<ipython-input-4-fe3d6858cad8> in <module>
----> 1 client.get_domains()
~/anaconda/lib/python3.8/site-packages/godaddypy/client.py in get_domains(self, **params)
147 """
148 url = self.API_TEMPLATE + self.DOMAINS
--> 149 data = self._get_json_from_response(url, params=params)
150 domains = list()
151 for item in data:
~/anaconda/lib/python3.8/site-packages/godaddypy/client.py in _get_json_from_response(self, url, json, **kwargs)
73
74 def _get_json_from_response(self, url, json=None, **kwargs):
---> 75 return self._request_submit(requests.get, url=url, json=json, **kwargs).json()
76
77 def _log_response_from_method(self, req_type, resp):
~/anaconda/lib/python3.8/site-packages/godaddypy/client.py in _request_submit(self, func, **kwargs)
95 resp = func(headers=self._get_headers(), **kwargs)
96 self._log_response_from_method(func.__name__, resp)
---> 97 self._validate_response_success(resp)
98 return resp
99
~/anaconda/lib/python3.8/site-packages/godaddypy/client.py in _validate_response_success(response)
105 response.raise_for_status()
106 except Exception:
--> 107 raise BadResponse(response.json())
108
109 def add_record(self, domain, record):
BadResponse: Response Data: {'code': 'UNABLE_TO_AUTHENTICATE', 'message': 'Unauthorized : Could not authenticate API key/secret'}
Hi ,
I am unable to add MX records with priority using 'godaddypy'. Can you please help me on this.
Describe the bug
Failed to establish a new connection: [WinError 10051] 向一个无法连接的网络尝试了一个套接字操作。'))
In the Chinese network, I must use a proxy to access godaddy . how can i use godaddypy with proxy
When a log level is passed to the client (e.g. logging.DEBUG) the handler is not found raising:
No handlers could be found for logger "GoDaddyPy.Client"
Fixing it in Client.py module
# Logging setup
logging.basicConfig()
self.logger = logging.getLogger('GoDaddyPy.Client')
I'm able to connect to the server, but when I call "client.update_ip" I get the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/godaddypy/client.py", line 96, in _validate_response_success
response.raise_for_status()
File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.godaddy.com/v1/domains/casahespanha.com/records/A/@
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./godaddypy-dyndns.py", line 48, in
rc=client.update_ip(public_ip, domains=[domain])
File "/usr/local/lib/python3.5/dist-packages/godaddypy/client.py", line 245, in update_ip
self.update_record(domain, record)
File "/usr/local/lib/python3.5/dist-packages/godaddypy/client.py", line 299, in update_record
self._put(url, json=record)
File "/usr/local/lib/python3.5/dist-packages/godaddypy/client.py", line 66, in _put
return self._request_submit(requests.put, url=url, json=json, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/godaddypy/client.py", line 82, in _request_submit
self._validate_response_success(resp)
File "/usr/local/lib/python3.5/dist-packages/godaddypy/client.py", line 98, in _validate_response_success
raise BadResponse(response.json())
godaddypy.client.BadResponse: Response Data: {'fields': [{'path': 'records', 'message': 'is not a array', 'code': 'UNEXPECTED_TYPE'}], 'message': "Request body doesn't fulfill schema, see details in fields
", 'code': 'INVALID_BODY'}
This happens even with the code in the README.rst example
Any idea what the problem could be?
Since the models are defined at then end of the page, it could be nice to have some validation
https://developer.godaddy.com/doc/endpoint/domains
Perhaps using https://schematics.readthedocs.io/en/latest/ ?
This is the 3.0.0 milestone planning tracker. If anyone has suggestions for things to be added/modified for the 3.0.0 release, please post them here and I'll add them to the tracker.
Upgrade GoDaddyPy to support more than just the Domains API.
Other GoDaddy APIs currently available are:
Hi,
I've been trying to delete MX records using this code line:
client.delete_records(domain, name='@', record_type='MX')
The long error message ends wtih:
godaddypy.client.BadResponse: Response Data: {'code': 'INVALID_RECORDS', 'fields': [{'code': 'INVALID_RECORDS', 'message': 'Invalid [ipaddress] provided for record data, [Parked].', 'path': 'records'}], 'message': 'One or more of the given records is invalid', 'errors': ['Invalid [ipaddress] provided for record data, [Parked].']}
I can't really see what I'm doing wrong, the code line is simple enough and all I did is to add the record_type='MX' which should work according to the documentation.
ALSO, I this line DOES work:
mx_records = client.get_records(domain, record_type='MX')
(which means that there's nothing wrong with "record_type='MX'")
This is a great library. Thanks!
I wrote this function which i find useful, thought others might too:
if you are doing a lot of additions/updates it is better to generate exist
first and pass it in rather than have each call get the existing records.
def add_or_update(domain, ip, value, record_type='A', exist=None):
if not exist:
exist = client.get_records(domain, record_type=record_type)
names = [x['name'] for x in exist]
if value in names:
if exist[names.index(value)]['data'] != ip:
client.update_record_ip(ip, domain,value,record_type)
print(f'Updated {value}.{domain} to point to {ip}.')
else:
print(f'{value}.{domain} already points to {ip}. Not changing anything.')
else:
client.add_record(domain,
{
'data': ip,
'name': value,
'ttl':3600,
'type':record_type
})
print(f'Added record for {value}.{domain} to point to {ip}.')
We are getting the response as combination of reseller account and self account available domain names and also all the available domain names are not listed.
The long description on PyPI is not correct anymore. It should be the same as the README.md.
How to retreve the domains in Reseller account .
How to get Xshoper id
Response Data: {
u'fields': [ {
u'path': u'records',
u'message': u'is not a array',
u'code': u'UNEXPECTED_TYPE'
} ],
u'message': u"Request body doesn't fulfill schema, see details in fields
",
u'code': u'INVALID_BODY'
}
We are using godaddypy lib to manage our godaddy records.
We are running api's multiple times as part of our CI\CD pipeline and we got following error on one of instance, can you please help us analyze and fix same.
I have gone through multiple forums and found one issue logged with requests lib for similar error.
psf/requests#4256
But since we are not directly invoking requests , I am not sure how to tackle this.
We are invoking this API's from Docker container running inside Ubuntu Host
Versions used.
GoDaddyPy==2.2.5
requests==2.18.4
get_record("A",recordname,domainname)
return self.godaddy_client.get_records(domainname, recordtype, name=recordname)
[20:40:08] File "/usr/local/lib/python2.7/dist-packages/godaddypy/client.py", line 180, in get_records
[20:40:08] data = self._get_json_from_response(url)
[20:40:08] File "/usr/local/lib/python2.7/dist-packages/godaddypy/client.py", line 56, in _get_json_from_response
[20:40:08] return self._request_submit(requests.get, url=url, json=json, **kwargs).json()
[20:40:08] File "/usr/local/lib/python2.7/dist-packages/godaddypy/client.py", line 80, in _request_submit
[20:40:08] resp = func(headers=self._get_headers(), **kwargs)
[20:40:08] File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 72, in get
[20:40:08] return request('get', url, params=params, **kwargs)
[20:40:08] File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 58, in request
[20:40:08] return session.request(method=method, url=url, **kwargs)
[20:40:08] File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 508, in request
[20:40:08] resp = self.send(prep, **send_kwargs)
[20:40:08] File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 618, in send
[20:40:08] r = adapter.send(request, **kwargs)
[20:40:08] File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 506, in send
[20:40:08] raise SSLError(e, request=request)
[20:40:08]requests.exceptions.SSLError: HTTPSConnectionPool(host='api.godaddy.com', port=443): Max retries exceeded with url: /v1/domains//records/A/ (Caused by SSLError(SSLError("bad handshake: SysCallError(104, 'ECONNRESET')",),))
version 2.5.1
from godaddypy import Account
Traceback (most recent call last):
File "", line 1, in
File "/Users/user/lib/python3.7/site-packages/godaddypy/init.py", line 1, in
from .client import Client
File "/Users/user/lib/python3.7/site-packages/godaddypy/client.py", line 8, in
from .account import Account
File "/Users/user/lib/python3.7/site-packages/godaddypy/account.py", line 50, in
class Account(object):
File "/Users/user/lib/python3.7/site-packages/godaddypy/account.py", line 103, in Account
def __parse_configuration(self) -> Configuration | None:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Code runs abnormally
https://developer.godaddy.com/doc/endpoint/domains#/v1/recordReplace
DEBUG:Response data: b'{"code":"INVALID_BODY","fields":[{"code":"UNEXPECTED_TYPE","message":"is not a array","path":"records"}],"message":"Request body doesn't fulfill schema, see details in fields
"}\n'
def _put(self, url, json=None, **kwargs):
return self._request_submit(requests.put, url=url, json=json, **kwargs)
The json parameter is a dict, a quick test is to change json=[json] which passes the API.
Describe the bug
Your requirements are not correctly documented, causing them to not be installed, resulting in a broken package. The install_requires parameter in your setup.py needs to include everything in your requirements.txt.
To Reproduce
Steps to reproduce the behavior:
python3.11 -m venv .env
. .env/bin/activate
pip install GoDaddyPy==2.5.1
python -c "from godaddypy import Client, Account"
Expected behavior
Package should be importable after installation. Instead, package throws the error: ModuleNotFoundError: No module named 'configloader'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.