A simple script that lists currently existed cloud server is below. For more examples and API documentation please refer to the github directories:
https://github.com/rackspace/pyrax/tree/master/docs
https://github.com/rackspace/pyrax/tree/master/samples
Problem
By default an execution of the script generate this error:
Traceback (most recent call last): File "C:\Users\radoslaw\workspace\api-challenge\challange1.py", line 6, in <module> pyrax.set_credential_file(conf) File "c:\Python27\lib\site-packages\pyrax\__init__.py", line 215, in set_credential_file authenticate=authenticate) File "c:\Python27\lib\site-packages\pyrax\rax_identity.py", line 108, in set_credential_file self.authenticate() File "c:\Python27\lib\site-packages\pyrax\rax_identity.py", line 138, in authenticate raise exc.AuthenticationFailed("Incorrect/unauthorized " pyrax.exceptions.AuthenticationFailed: Incorrect/unauthorized credentials received
By default the function pyrax.set_credential_file(conf) assumes your cloud account belongs to the USA. For it to work you need to specify the LONDON region like in the commented code above.
pyrax.set_credential_file(conf, "LON")
No comments:
Post a Comment