mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
Replacing print statements with logger.info
This commit is contained in:
parent
7a19c5db25
commit
d1485d9cd5
1 changed files with 9 additions and 6 deletions
|
|
@ -1,6 +1,11 @@
|
||||||
from social.apps.django_app.default.models import UserSocialAuth
|
import logging
|
||||||
import requests
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
import requests
|
||||||
|
from social.apps.django_app.default.models import UserSocialAuth
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class AccessTokenNotFound(Exception):
|
class AccessTokenNotFound(Exception):
|
||||||
|
|
@ -50,17 +55,16 @@ def google_api_get(email, url):
|
||||||
Authorization="Bearer %s" % get_google_access_token(email),
|
Authorization="Bearer %s" % get_google_access_token(email),
|
||||||
)
|
)
|
||||||
r = requests.get(url, headers=headers)
|
r = requests.get(url, headers=headers)
|
||||||
print "I got a %s" % r.status_code
|
logger.info("I got a %s", r.status_code)
|
||||||
if r.status_code == 401:
|
if r.status_code == 401:
|
||||||
# Go use the refresh token
|
# Go use the refresh token
|
||||||
refresh_authorization(email)
|
refresh_authorization(email)
|
||||||
r = requests.get(url, headers=headers)
|
r = requests.get(url, headers=headers)
|
||||||
print "I got a %s" % r.status_code
|
logger.info("I got a %s", r.status_code)
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
try:
|
try:
|
||||||
return r.json()
|
return r.json()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print "returning text"
|
|
||||||
return r.text
|
return r.text
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -79,7 +83,6 @@ def google_api_post(email, url, post_data, authorized=True):
|
||||||
try:
|
try:
|
||||||
return r.json()
|
return r.json()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print "returning text"
|
|
||||||
return r.text
|
return r.text
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue