Does lexicon support update? I am trying to update DKIM value but getting requests.exceptions.HTTPError: 404 Client Error: Not Found.
See original GitHub issue_I wanted to update the existing value of DKIM using a lexicon. But using lexicon update is not working for me. Can you help me with this? Below is the command I am using to update DKIM value.
lexicon Command :-
lexicon digitalocean update sampledomain.com TXT --name='pepi._domainkey.sampledomain.com' --content='k=rsa;
p=AAAAAAAAAAAAAAAAAMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLMMExLiGRqzJkNdNIjUnLX7JL0wjbwwENDoXgJIBisIsrofLPetZM401dioNU8k/Qp6nIyi5oioyZh+1jDXoCPFa4nLGRNj3Nz785N7b76aTtHmy2wTgR2LFS/Yw5/iyzhyrWsIyINyyHs77EoCwSOQjJfhFxb6SmifLN51IIvwIDAQAB'
Below is the output getting after executing the above command.
Traceback (most recent call last): File "/usr/bin/lexicon", line 9, in <module> load_entry_point('dns-lexicon==2.7.9', 'console_scripts', 'lexicon')() File "/usr/lib/python2.7/site-packages/lexicon/__main__.py", line 136, in main results = client.execute() File "/usr/lib/python2.7/site-packages/lexicon/client.py", line 47, in execute return self.provider.update_record(self.options.get('identifier'), self.options.get('type'), self.options.get('name'), self.options.get('content')) File "/usr/lib/python2.7/site-packages/lexicon/providers/digitalocean.py", line 94, in update_record payload = self._put('/domains/{0}/records/{1}'.format(self.domain_id, identifier), data) File "/usr/lib/python2.7/site-packages/lexicon/providers/base.py", line 79, in _put return self._request('PUT', url, data=data, query_params=query_params) File "/usr/lib/python2.7/site-packages/lexicon/providers/digitalocean.py", line 136, in _request r.raise_for_status() # if the request fails for any reason, throw an error. File "/usr/lib/python2.7/site-packages/requests/models.py", line 834, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found
I have exported all required parameters and working fine with the list and create commands but not with update one.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top GitHub Comments
I am saying that because there is two way to update a record: by unique identifier or by matching the given type and name.
But for the latter case, there is a flaw, because several records could match a given type and name. Indeed most of the time, you can insert multiple TXT for a given name.
And if multiple matches are found, some providers will update the first match, other will not update anything, other will throw errors because they do not handle such a case. Cloudflare provider could fall in the second or third category.
OK, you have another approach. First, use:
That will return a json containing your record, and in particular an identifier field.
Then run:
With IDENTIFIER the identifier value you got from the list action.
All of this suppose that you have set correctly the environment variables or the cli arguments to provide the authentification parameters required to access your account, but if you have already managed to use list and create, it is already the case.