dopy.manager.DoError: Unable to authenticate you
<p>I'm trying to configure a Virtual Machine(with Vagrant and Ansible), that needs a file.py to the full correct configuration of this machine (according to the book that I'm studying),I'm was using the DigitalOcean API V2, but as I have no a valid credit card my account is bloked,so I had to change DigitalOcean to AWS,as the company where I work have an account with AWS,now I take the 'client id' and 'api key' from AWS VM,so the foregoing problems returned...when I try use the "python file.py" command the output says again: </p>

<blockquote>
  <p>dopy.manager.DoError: Unable to authenticate you.</p>
</blockquote>

<pre><code>**the file.py:** 

    """
    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_KEY")

    #do = DoManager(cliend_id, api_key)
    do = DoManager(None, api_token, api_version=2)

    keys = do.all_ssh_keys()
    print "ssh key name\tid"
    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>I appreciate any help.  </p>

<p>Try to remove quotes from api_token:</p>

<pre><code>do = DoManager(None, api_token, api_version=2)
</code></pre>

<p>Otherwise your token is always literal string <em>api_token</em>, not a variable api_token.</p>

python vagrant ansible