1- __version__ = '1.5.0'
2-
3- import requests , os , warnings , hashlib , hmac , jwt , time , uuid , sys
4-
51from platform import python_version
62
3+ import hashlib
4+ import hmac
5+ import jwt
6+ import os
7+ import requests
8+ import sys
9+ import time
10+ from uuid import uuid4
11+ import warnings
12+
713if sys .version_info [0 ] == 3 :
814 string_types = (str , bytes )
915else :
1016 string_types = (unicode , str )
1117
18+ __version__ = '1.5.0'
19+
1220
1321class Error (Exception ):
1422 pass
@@ -257,10 +265,10 @@ def signature(self, params):
257265 md5 .update (self .signature_secret .encode ('utf-8' ))
258266 return md5 .hexdigest ()
259267
260- def get (self , host , request_uri , params = {} ):
268+ def get (self , host , request_uri , params = None ):
261269 uri = 'https://' + host + request_uri
262270
263- params = dict (params , api_key = self .api_key , api_secret = self .api_secret )
271+ params = dict (params or {} , api_key = self .api_key , api_secret = self .api_secret )
264272
265273 return self .parse (host , requests .get (uri , params = params , headers = self .headers ))
266274
@@ -301,10 +309,10 @@ def parse(self, host, response):
301309
302310 raise ServerError (message )
303311
304- def __get (self , request_uri , params = {} ):
312+ def __get (self , request_uri , params = None ):
305313 uri = 'https://' + self .api_host + request_uri
306314
307- return self .parse (self .api_host , requests .get (uri , params = params , headers = self .__headers ()))
315+ return self .parse (self .api_host , requests .get (uri , params = params or {} , headers = self .__headers ()))
308316
309317 def __post (self , request_uri , params ):
310318 uri = 'https://' + self .api_host + request_uri
@@ -328,7 +336,7 @@ def __headers(self):
328336 payload .setdefault ('application_id' , self .application_id )
329337 payload .setdefault ('iat' , iat )
330338 payload .setdefault ('exp' , iat + 60 )
331- payload .setdefault ('jti' , str (uuid . uuid4 ()))
339+ payload .setdefault ('jti' , str (uuid4 ()))
332340
333341 token = jwt .encode (payload , self .private_key , algorithm = 'RS256' )
334342
0 commit comments