Ansible VM:TypeError: __init__() takes at least 3 arguments (2 given)
<p>I'm learning about virtual machine and others, I'm trying to configure a VM(with Ansible and DigitalOcean API V2)that needs a file.py to the full correct configuration of this machine (according to the book that I'm studying), but when I try use the command <strong>python do_api_v1.py</strong> the output says:</p>

<blockquote>
  <p>**Traceback (most recent call last):</p>
  
  <p>File "do_api_v1.py", line 12, in 
      do = DoManager(token) TypeError: <strong>init</strong>() takes at least 3 arguments (2 given)
  **</p>
</blockquote>

<p>the file do_api_v1.py it is like: </p>

<pre><code>"""
dependencias: 
    sudo pip install dopy pyopenssl ndg-httpsclient pyasn1
"""

import os
from dopy.manager import DoManager
import urllib3.contrib.pyopenssl
urllib3.contrib.pyopenssl.inject_into_urllib3()


api_version = os.getenv("DO_API_VERSION")
api_token=os.getenv("DO_API_

do = DoManager(None, 'api_token', 'api_version')

keys = do.all_ssh_keys()
print "ssh key nametid"
for key in keys:
    print "%s\t%d" % (key["name"], key["id"])

print "Image name\tid"
imgs = do.all_images()
for img in imgs:
    if img["slug"] == "ubuntu-14-04-x64":
        print "%s\t%d" % (img["name"], img["id"])

print "Region name\tid"
regions = do.all_regions()
for region in regions:
    if region["slug"] == "nyc2":
        print "%s\t%d" % (region["slug"], region["id"])

print "Size name\tid"
sizes = do.sizes()
for size in sizes:
    if size["slug"] == "512mb":
        print "%s\t%d" % (size["slug"], size["id"])
</code></pre>

<p>You are not passing enough arguments to <a href="https://github.com/Wiredcraft/dopy/blob/8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0/dopy/manager.py#L47" rel="nofollow"><code>DoManager</code></a> as the error message says. You need to pass an obligatory <code>client_id</code> as the first argument, and an <code>api_key</code> as the second.</p>

python virtual-machine ansible