This repository was archived by the owner on Nov 4, 2020. It is now read-only.
File tree 2 files changed +20
-19
lines changed 2 files changed +20
-19
lines changed Original file line number Diff line number Diff line change @@ -57,22 +57,6 @@ def getsshkeys(self):
57
57
else :
58
58
return False
59
59
60
- def getsshkey (self , key_id ):
61
- """
62
- Get a single ssh key identified by key_id
63
-
64
- :param key_id: the id of the key
65
- :return: the key itself
66
- """
67
- request = requests .get (
68
- '{0}/{1}' .format (self .keys_url , key_id ),
69
- headers = self .headers , verify = self .verify_ssl , auth = self .auth , timeout = self .timeout )
70
-
71
- if request .status_code == 200 :
72
- return request .json ()
73
- else :
74
- return False
75
-
76
60
def addsshkey (self , title , key ):
77
61
"""
78
62
Add a new ssh key for the current user
Original file line number Diff line number Diff line change 1
1
from gitlab .base import Base
2
+ from gitlab .helper import deprecated
2
3
3
4
4
5
class Keys (Base ):
5
- def keys (self , id ):
6
+ def keys (self , key_id ):
6
7
"""
7
8
Get SSH key with user by ID of an SSH key. Note only administrators can lookup SSH key with user by ID of an
8
9
SSH key.
@@ -11,7 +12,23 @@ def keys(self, id):
11
12
>>> gitlab.login(user='root', password='5iveL!fe')
12
13
>>> gitlab.keys(1)
13
14
14
- :param id : The ID of an SSH key
15
+ :param key_id : The ID of an SSH key
15
16
:return: Dictionary containing Key data
16
17
"""
17
- return self .get ('/keys/{id}' .format (id = id ), default_response = {})
18
+ return self .get ('/keys/{key_id}' .format (key_id = key_id ), default_response = {})
19
+
20
+ @deprecated
21
+ def getsshkey (self , key_id ):
22
+ """
23
+ Get a single ssh key identified by key_id
24
+
25
+ .. warning:: Warning this is being deprecated please use :func:`gitlab.Gitlab.keys`
26
+
27
+ >>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
28
+ >>> gitlab.login(user='root', password='5iveL!fe')
29
+ >>> gitlab.getsshkeys(1)
30
+
31
+ :param key_id: The ID of an SSH key
32
+ :return: Dictionary containing Key data
33
+ """
34
+ return self .keys (key_id )
You can’t perform that action at this time.
0 commit comments