Closed alicegoldfuss closed 8 years ago
Hi @alicegoldfuss, I'm having trouble duplicating the issue.
The record.update()
method should allow answers
to be a string(record.update answer parsing).
What type are you passing in when the record is not being updated(I assumed a string)?
I tested locally with both requests
and twisted
transports.
from nsone import NSONE
if __name__ == '__main__':
nsone = NSONE(apiKey='apiKey')
zone = nsone.loadZone('example.com')
rec = zone.loadRecord('orchid', 'A')
rec.update(answers='2.2.2.6')
rec.update(answers=['2.2.2.7'])
And the record was successfully updated.
Also, when using an integer for answers
, I received the exception
Exception: invalid answers format (must be str or list)
Hi @pashap
I wasn't able to repro it again, either (I think my interpreter wasn't reloading my module when I re-imported it after editing). However, I did find that:
zone.update(answers=new_address)
doesn't raise an exception. What sort of behavior is expected here?
Thanks!
Great point @alicegoldfuss, the client should definitely raise an exception in this instance.
In our api documentation under POST zones/:zone
, you will see which fields are allowed when updating a zone.
One reason this won't work is because a zone doesn't have answers(although a zone does have records, which in turn have answers).
If you want to update a zones' records' answers, you will need to go through the Record
endpoint instead of the Zone
endpoint(which is what you are doing in record.update
).
The clients' resource/class to url/endpoint
mapping looks like:
<nsone.zones.Zone> : https://api.nsone.net/v1/zones
<nsone.records.Record> : https://api.nsone.net/v1/zones/:zone/:domain/:type
The allowed fields for a zone POST can also be seen in Zone allowed fields.
Please let me know if I didn't explain that well. Thanks for recognizing and creating an issue for this, we will ensure the client raises an exception for this case.
@pashap thank you! I think at some point I was calling zone.update(answers=new_address)
instead of record.update(answers=new_address)
and since it didn't fail, I had a tough time diagnosing the issue.
Thanks for your quick help!
I was testing an implementation of the record update method and found that it failed silently sometimes. My code was slightly wrong:
instead of
but no exception was raised. I would have expected some sort of "record does not exist" or "incorrect data type" error.