Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge cbc4490 into b549b14
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlmorton committed Feb 7, 2015
2 parents b549b14 + cbc4490 commit b0caa91
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ptero_common/logging_configuration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from termcolor import colored
import requests
from requests.models import Request
from requests.exceptions import ConnectionError
import logging
import os
from pprint import pformat
Expand Down Expand Up @@ -82,6 +83,8 @@ def wrapper(*args, **kwargs):

try:
response = target(*args, **kwargs)
except ConnectionError:
raise
except Exception as e:
logger.exception(
"Unexpected exception while sending %s request\n"
Expand All @@ -91,7 +94,12 @@ def wrapper(*args, **kwargs):
kind.upper(), pformat(args), pformat(kwargs), str(e))
raise

if 'timeout' in kwargs:
# timout is an argument to requests.get/post/ect but not
# Request.__init__
del kwargs['timeout']
r = Request(kind.upper(), *args, **kwargs)

logger.info("%s from %s %s", response.status_code, kind.upper(), r.url)
for name in ['params', 'headers', 'data']:
logger.debug(" %s%s: %s", name[0].upper(), name[1:],
Expand Down

0 comments on commit b0caa91

Please sign in to comment.