Skip to content

Commit

Permalink
Log the URL used for the api request.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashchristopher committed Jan 2, 2012
1 parent a6fb547 commit e391c8b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bottlenose/api.py 100644 → 100755
Expand Up @@ -9,6 +9,7 @@
import hmac import hmac
import time import time
import socket import socket
import logging


from hashlib import sha256 from hashlib import sha256


Expand Down Expand Up @@ -79,6 +80,8 @@ def __getattr__(self, k):
Style=self.Style, Region=self.Region, Timeout=self.Timeout) Style=self.Style, Region=self.Region, Timeout=self.Timeout)


def __call__(self, **kwargs): def __call__(self, **kwargs):
logger = logging.getLogger(__name__)

kwargs['Timestamp'] = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()) kwargs['Timestamp'] = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
kwargs['Operation'] = self.Operation kwargs['Operation'] = self.Operation
kwargs['Version'] = self.Version kwargs['Version'] = self.Version
Expand Down Expand Up @@ -110,6 +113,7 @@ def __call__(self, **kwargs):
api_request = urllib2.Request(api_string, headers={"Accept-Encoding": "gzip"}) api_request = urllib2.Request(api_string, headers={"Accept-Encoding": "gzip"})
if self.Timeout: if self.Timeout:
socket.setdefaulttimeout(self.Timeout) socket.setdefaulttimeout(self.Timeout)
logger.debug("Amazon URL: %s" % api_string)
response = urllib2.urlopen(api_request) response = urllib2.urlopen(api_request)
if self.Timeout: if self.Timeout:
socket.setdefaulttimeout(None) socket.setdefaulttimeout(None)
Expand Down

0 comments on commit e391c8b

Please sign in to comment.