@@ -27,9 +27,9 @@ class APIResourceClient(object):
27
27
def logged_curl (self , method , url , params ):
28
28
dict_params = self .to_dict (params )
29
29
self .log_request (method , url , params , dict_params )
30
- rbody , rcode , _ = clever .APIRequestor ().request_raw (method , url , dict_params )
31
- self .log_result (rbody , rcode )
32
- return rbody , rcode
30
+ res , auth = clever .APIRequestor ().request_raw (method , url , dict_params )
31
+ self .log_result (res [ 'body' ], res [ 'code' ] )
32
+ return res [ 'body' ], res [ 'code' ]
33
33
34
34
def log_request (self , method , url , ordered_params , dict_params ):
35
35
if method .lower () == 'get' :
@@ -46,7 +46,9 @@ class APIResourceClient(object):
46
46
term = ' \\ '
47
47
else :
48
48
term = ''
49
- curl = ['curl %s%s -H "Authorization: Basic %s"%s' % (clever .api_base , url , base64 .b64encode (clever .api_key ), term )]
49
+ api_key = clever .get_api_key ()
50
+ curl = ['curl %s%s -H "Authorization: Basic %s"%s' %
51
+ (clever .api_base , url , base64 .b64encode (api_key ), term )]
50
52
if isinstance (ordered_params , list ):
51
53
for i , (k , v ) in enumerate (ordered_params ):
52
54
if i == len (ordered_params ) - 1 :
@@ -170,11 +172,11 @@ event
170
172
171
173
klass_name = args [0 ]
172
174
method_name = args [1 ]
173
-
174
- clever .api_key = opts .api_key or os .environ .get ('CLEVER_API_KEY' )
175
- if not clever .api_key :
175
+ api_key = opts .api_key or os .environ .get ('CLEVER_API_KEY' )
176
+ if not api_key :
176
177
parser .error ('No API key provided (use -k option or set the CLEVER_API_KEY environment variable' )
177
178
return 1
179
+ clever .set_api_key (api_key )
178
180
179
181
if opts .api_base :
180
182
clever .api_base = opts .api_base
0 commit comments