Fix authentication on some older Android devices (#58)

This commit is contained in:
Michaël Arnauts 2020-11-28 17:16:11 +01:00 committed by GitHub
parent 57b2ac36c0
commit 80045cdb4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,6 @@ import hmac
import json
import logging
import os
import sys
import requests
import six
@ -340,11 +339,7 @@ class AwsIdp:
days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
time_now = datetime.datetime.utcnow()
if sys.platform.startswith('win'):
format_string = "{} {} %#d %H:%M:%S UTC %Y".format(days[time_now.weekday()], months[time_now.month])
else:
format_string = "{} {} %-d %H:%M:%S UTC %Y".format(days[time_now.weekday()], months[time_now.month])
format_string = "{} {} {} %H:%M:%S UTC %Y".format(days[time_now.weekday()], months[time_now.month], time_now.day)
time_string = datetime.datetime.utcnow().strftime(format_string)
return time_string