Skip to content

Commit 77282c2

Browse files
committed
fix: LegacyRegion.get_bucket_host not working in python2
1 parent b58675e commit 77282c2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

qiniu/region.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ def get_bucket_hosts(self, ak, bucket, home_dir=None, force=False):
189189
}
190190

191191
ttl = region.ttl if region.ttl > 0 else 24 * 3600 # 1 day
192-
bucket_hosts['deadline'] = region.create_time.timestamp() + ttl
192+
# use datetime.datetime.timestamp() when min version of python >= 3
193+
create_time = int(float(region.create_time.strftime('%s.%f')) * 1000)
194+
bucket_hosts['deadline'] = create_time + ttl
193195

194196
return bucket_hosts
195197

0 commit comments

Comments
 (0)