Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

import hashlib, hmac, string. base64, urllib

# Reference GET/POST sample request
#
# 1. http://10.10.0.1:8080/client/api
# 2. ?apiKey=API_KEY
# 3. &command=API_COMMAND
# 4. &response=JSON/XML
# 5. &zoneid=ZONE_ID
# 6. &signature=SIGNATURE

# Reference required signature elements
#
# 1. request
# 2. apiKey
# 3. private_key

api_url = 'http://10.10.0.1:8080/client/api'

...

    def _build_post_request(self):
        self.query += '&signature=' + urllib.quote_plus(self.signature)
        self.value = self.api_url + '?' + self.query# Example Usage:
#

  1. api.value is a debug that holds the complete valid URL request.
    #
  2. api.decoded is the response from executing the API request.
    api = SignedAPICall(api_url, apiKey,, secret)
    api.request(request)

print api.value