File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 12
12
needed by LibreNMS check plugins."""
13
13
14
14
__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
15
- __version__ = '2021112202 '
15
+ __version__ = '2022012101 '
16
16
17
17
import time
18
18
@@ -51,7 +51,8 @@ def get_creds(args):
51
51
timeout = args .TIMEOUT ,
52
52
))
53
53
ibasetoken = result .get ('response_json' ).get ('data' ).get ('iBaseToken' )
54
- cookie = result .get ('response_header' ).getheader ('Set-Cookie' )
54
+ # In Python 3, getheader() should be get()
55
+ cookie = result .get ('response_header' ).get ('Set-Cookie' )
55
56
expire = base3 .now () + args .CACHE_EXPIRE * 60
56
57
cache3 .set ('huawei-{}-ibasetoken' .format (args .DEVICE_ID ), ibasetoken , expire )
57
58
cache3 .set ('huawei-{}-cookie' .format (args .DEVICE_ID ), cookie , expire )
Original file line number Diff line number Diff line change 12
12
Credits go to https://github.com/surfer190/veeam/blob/master/veeam/client.py."""
13
13
14
14
__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
15
- __version__ = '2022012001 '
15
+ __version__ = '2022012101 '
16
16
17
17
import base64
18
18
@@ -44,7 +44,9 @@ def get_token(args):
44
44
if not success :
45
45
return (success , result )
46
46
if not result :
47
- return (False , 'There was no result from {}.' .format (url ), False )
48
- if not 'X-RestSvcSessionId' in result :
49
- return (False , 'Something went wrong, maybe user is unauthorized.' , False )
47
+ return (False , 'There was no result from {}.' .format (url ))
48
+ # In Python 3, getheader() should be get()
49
+ result ['X-RestSvcSessionId' ] = result .get ('response_header' ).get ('X-RestSvcSessionId' )
50
+ if not result ['X-RestSvcSessionId' ]:
51
+ return (False , 'Something went wrong, maybe user is unauthorized.' )
50
52
return (True , result )
You can’t perform that action at this time.
0 commit comments