Giter VIP home page Giter VIP logo

transip-api's Introduction

TransIP API

Build Status Documentation Status

This library aims to implement the TransIP API in Python.

Quick Start

Prerequisite

  • Make sure you have an account at TransIP
  • Enable the API (https://www.transip.nl/cp/mijn-account/#api)
  • Whitelist your IP.
  • Generate a new key-pair.
    • Copy-paste the private key into a file.
    • Put the private key in a file called decrypted_key beside this README.rst file.

Setup

You can get the library directly from PyPi:

$ pip install transip

Example

The command-line interpreter doesn't do much yet. By default it does a getDomainNames() call, but with the '-u' option it's also possible to add or update DNS records. When calling it with '-h', it will show all available options.

$ transip-api -l username
[example.com, example.org, example.net]

$ transip-api -h
usage: transip-api [-h] [-l LOGINNAME] [-s] [-a] [-u] [-d]
                   [--domain-name DOMAIN_NAME] [--entry-name ENTRY_NAME]
                   [--entry-expire ENTRY_EXPIRE] [--entry-type ENTRY_TYPE]
                   [--entry-content ENTRY_CONTENT] [--api-key PRIVATE_KEY_FILE]

optional arguments:
  -h, --help            show this help message and exit
  -l LOGINNAME, --login-name LOGINNAME
                        TransIP username
  -s, --show-dns-entries
                        show all DNS entries for a domain
  -a, --add-dns-entry   add an entry in the DNS
  -u, --update-dns-entry
                        update an entry in the DNS
  -d, --delete-dns-entry
                        delete an entry in the DNS
  --domain-name DOMAIN_NAME
                        domain name to use
  --entry-name ENTRY_NAME
                        name of the DNS entry
  --entry-expire ENTRY_EXPIRE
                        expire time of the DNS entry
  --entry-type ENTRY_TYPE
                        type of the DNS entry
  --entry-content ENTRY_CONTENT
                        content of the DNS entry
  --api-key PRIVATE_KEY_FILE
                        TransIP private key

Example of adding/updating a record:

$ transip-api -l username -u --api-key privatekey --domain-name example.com --entry-name testentry --entry-expire 86400 --entry-type A --entry-content 127.0.0.1
Request finished successfully.

Documentation

Further documentation can be found in the docs directory, or on https://transip-api.readthedocs.io/en/latest/.

FAQ

Question:

When using the library I get SSL errors such as:

urllib2.URLError: <urlopen error [Errno 1] _ssl.c:510: error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 unrecognized name>

Answer:

The suds library has fairly limited SSL support which is dependent on the Python version, to work around this the suds_requests library can be used which replaces urllib2 with the requests library. Additionally the requests library automatically pools connections which makes the library slightly faster to use. To install:

pip install suds_requests

transip-api's People

Contributors

72616e646f6d avatar ana-cc avatar benkonrath avatar daramousk avatar foarsitter avatar frankhuurman avatar greenren avatar mhogerheijde avatar mjrider avatar mrleerkotte avatar nielsderdaele avatar roaldnefs avatar safplusplus avatar wolph avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.