vinyldns / vinyldns-python Goto Github PK
View Code? Open in Web Editor NEWPython client library for VinylDNS
License: Apache License 2.0
Python client library for VinylDNS
License: Apache License 2.0
https://pep257.readthedocs.io/en/latest/ seem to work.
Need to run the linter and address any issues it finds. Will also want to tie this into our travis checks (see #10)
Ran the following commands:
client = VinylDNSClient("http://localhost:9000", "xxx", "xxx")
existing_txt = [rs for rs in existing_records.record_sets if rs.type == "TXT"][0]
data_to_add = TXTData("some-test-txt-to-add")
existing_txt.records.append(data_to_add)
existing_txt.records
[<vinyldns.record.TXTData object at 0x102e970f0>, <vinyldns.record.TXTData object at 0x102e53e48>]
updated = client.update_record_set(existing_txt)
Traceback (most recent call last):
File "", line 1, in
File "/Users/rstar201/Desktop/Vinyl/python/vinyldns-python/src/vinyldns/client.py", line 519, in update_record_set
to_json_string(record_set), **kwargs)
File "/Users/rstar201/Desktop/Vinyl/python/vinyldns-python/src/vinyldns/client.py", line 157, in __make_request
return self.__check_response(response)
File "/Users/rstar201/Desktop/Vinyl/python/vinyldns-python/src/vinyldns/client.py", line 164, in __check_response
raise BadRequestError(response.text)
vinyldns.client.BadRequestError: {"errors":["Invalid date format 2019-06-25T16:37:09+00:00"]}
the api doesnt use created/update on an update_recordset call anyway, so i just cleared those fields to avoid it, but we should fix to make sure people dont run into this same issue
In support of the new shared zones feature coming to VinylDNS we need to add the optional ownerGroupId
field to the BatchRecordChanges create method. Refer to the VinylDNS documentation for more information.
{
"comments": "this is optional",
"ownerGroupId": "f42385e4-5675-38c0-b42f-64105e743bfe"
"changes": [
{
"inputName": "example.com.",
"changeType": "Add",
"type": "A",
"ttl": 3600,
"record": {
"address": "1.1.1.1"
}
},
{
"inputName": "192.0.2.195",
"changeType": "Add",
"type": "PTR",
"ttl": 3600,
"record": {
"ptrdname": "ptrdata.data."
}
},
{
"inputName": "cname.example.com.",
"changeType": "DeleteRecordSet",
"type": "CNAME"
},
{
"inputName": "update.another.example.com.",
"changeType": "DeleteRecordSet",
"type": "AAAA"
},
{
"inputName": "update.another.example.com.",
"changeType": "Add",
"type": "AAAA",
"ttl": 4000,
"record": {
"address": "1:2:3:4:5:6:7:8"
}
}
]
}
Don't see info on how to run a release
We are using the lowercase letter L
as a variable name with can be confused with I
or 1
.
tests/test_membership.py:34:50: E741 ambiguous variable name 'l'
tests/test_membership.py:35:50: E741 ambiguous variable name 'l'
tests/test_membership.py:80:9: E741 ambiguous variable name 'l'
tests/test_membership.py:103:9: E741 ambiguous variable name 'l'
tests/test_membership.py:120:9: E741 ambiguous variable name 'l'
tests/test_membership.py:139:9: E741 ambiguous variable name 'l'
tests/test_membership.py:161:9: E741 ambiguous variable name 'l'
tests/test_batch_change.py:47:13: E741 ambiguous variable name 'l'
tests/test_batch_change.py:66:9: E741 ambiguous variable name 'l'
tests/test_batch_change.py:246:9: E741 ambiguous variable name 'l'
tests/test_records.py:32:50: E741 ambiguous variable name 'l'
tests/test_records.py:113:9: E741 ambiguous variable name 'l'
tests/test_records.py:139:9: E741 ambiguous variable name 'l'
tests/test_records.py:179:9: E741 ambiguous variable name 'l'
tests/test_zones.py:48:46: E741 ambiguous variable name 'l'
tests/test_zones.py:110:9: E741 ambiguous variable name 'l'
tests/test_zones.py:144:9: E741 ambiguous variable name 'l'
Saw that couple of commits were added, especially the global "search_record_sets" in client.py. For some reason, even a new pip install does not reflect that change in packages. Would you be able to help me with this one? Thanks!
Looks like a parsing issue.
โ Steps to Reproduce
Example:
local_client.get_record_set(zone_id,record_set_id)
get_record_set
line 198, in from_dict
zone_id=d['zoneId'],
KeyError: 'zoneId'
โ Possibly reasons
Method: get_record_set
line 525 : Client.py
return RecordSet.from_dict(data) if data is not None else None
needs to be changed to
return RecordSet.from_dict(data['recordSet']) if data is not None else None
API documentation: https://www.vinyldns.io/api/cancel-batchchange.html
Will be similar to the reject_batch_change method: https://github.com/vinyldns/vinyldns-python/blob/master/src/vinyldns/client.py#L666-L675
Background
We have most of the makings of a good vinyldns python client in the functional tests at https://github.com/vinyldns/vinyldns/blob/master/modules/api/functional_test/vinyldns_python.py
With a little cleanup, this can be moved into the vinyldns-python repository and setup as a first class project.
Scope of work
See #13 - same idea. Run flake8 and address any issues. We will want this tied into travis (or a commit hook) so we remain well-formatted.
The VinylDNS API has been updated to include a new global recordset search endpoint at /recordsets
. This client should be updated to support this new endpoint.
API endpoint documentation: https://www.vinyldns.io/api/get-zone-by-name.html
In support of the new shared zones feature coming to VinylDNS we need to add the optional ownerGroupId
field to the RecordSet create method.
{
"name": "foo",
"type": "A",
"ttl": 300,
"records": [
{
"address": "10.10.10.10"
}
],
"zoneId": "2467dc05-68eb-4498-a9d5-78d24bb0893c",
"ownerGroupId": "f42385e4-5675-38c0-b42f-64105e743bfe"
}
In this repo, there are few enough files (and likely wont be many more) that I think a pre-commit hook should work.
If there is some built-in python way to do this, do that. If not, a script is fine. See https://github.com/vinyldns/vinyldns/blob/master/bin/add-license-headers.sh for an example of how we scripted this for the non-scala files in the api
Background
Presently, the methods on the python client do not properly handle error conditions. The in line docs for the methods also do not indicate how each method could fail. This will make it difficult for anyone to use.
Solution
None
on a 404
raise
an error on other error codes coming back like Forbidden
, Conflict
, BadRequest
color
and ping
and especially post_status
create_zone
to connect_zone
delete_zone
to abandon_zone
build_request
We use Travis CI to build and test the VinylDNS Python client. Adding the Travis badge will quickly indicate that to users and let them know if the master branch is building and passing.
Should be: [![Travis build](https://api.travis-ci.org/vinyldns/vinyldns-python.svg?branch=master)](https://travis-ci.org/vinyldns/vinyldns-python)
see the main VinylDNS Readme for reference
See title. Need to have a python 3 version of this.
Unsure what amount of code changes are required for this, need to investigate
Can definitely leverage https://github.com/vinyldns/vinyldns-ruby for help on this. A few things to include:
pip install vinyldns-python
from vinyldns_python import *
vinyl_client = client.VinylDNSClient("http://localhost:9000", "testUserAccessKey", "testUserSecretKey")
vinyl_client.list_zones()
Docstrings are missing type info for parameters, which has led to confusion amongst some users. We should also enhance the docstrings with more detailed information where necessary.
Needs a little research (or expertise) here. We need some kind of testing framework.
Unclear on how to unit test this, since it is just an API wrapper for vinyldns api. There seem to be a lot of unit testing API tools out there, would like whoever starts this up to laydown some opinions on the matter. If not, this looked interesting and it works with pytest which we use for the vinyldns api - https://github.com/taverntesting/tavern
whatever testing is added here should be tied into travis
AC:
If the tests arent just copy/paste, we will make followup cards to test the other functions
The terraform-provider-vinyldns docs site uses docsify. It would be beneficial to users if the python client used a similar docs-as-code solution.
The API supports an isTest
flag in the zone connection request (model: https://github.com/vinyldns/vinyldns/blob/1a2d12a7e983a7229aec573a618b275edf1b3343/modules/core/src/main/scala/vinyldns/core/domain/zone/Zone.scala#L114).
The zone model needs to include isTest
so that String
serialization prints out this info.
Right now, to use this client, you have to create a new client:
client = VinylDNSClient(url, access_key, secret_key)
zones = client.getZones()
It would be nice to allow people to set the environment variables and call getZones (or all the other api functions) directly. This is similar to how the ruby client works (see https://github.com/vinyldns/vinyldns-ruby#requirements)
In support of the new shared zones feature coming to VinylDNS we need to add the optional ownerGroupId
field to the RecordSet update method.
{
"id": "dd9c1120-0594-4e61-982e-8ddcbc8b2d21",
"name": "already-exists",
"type": "A",
"ttl": 38400,
"records": [
{
"address": "6.5.4.3"
}
],
"zoneId": "2467dc05-68eb-4498-a9d5-78d24bb0893c",
"ownerGroupId": "f42385e4-5675-38c0-b42f-64105e743bfe"
}
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.