Skip to content

Commit

Permalink
fix issue #91
Browse files Browse the repository at this point in the history
  • Loading branch information
wjo1212 committed Aug 22, 2018
1 parent c86bc08 commit e0cc37b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions aliyun/log/logclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import zlib
from datetime import datetime
import logging
import locale

from .acl_response import *
from .consumer_group_request import *
Expand Down Expand Up @@ -58,13 +59,6 @@
DEFAULT_QUERY_RETRY_INTERVAL = 0.2


try:
import locale
locale.setlocale(locale.LC_ALL, str('en_US.UTF-8'))
except Exception as ex:
logger.info("failed to set locale to en_US.UTF-8. skip it: {0}".format(ex))


def _apply_cn_keys_patch():
"""
apply this patch due to an issue in http.client.parse_headers
Expand Down Expand Up @@ -172,6 +166,10 @@ def _setendpoint(self, endpoint):

@staticmethod
def _getGMT():
try:
locale.setlocale(locale.LC_TIME, "C")
except Exception as ex:
logger.info("failed to set locale time to C. skip it: {0}".format(ex))
return datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')

@staticmethod
Expand Down

0 comments on commit e0cc37b

Please sign in to comment.