forked from pyapi-gitlab/pyapi-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeys.py
More file actions
34 lines (26 loc) · 1.1 KB
/
keys.py
File metadata and controls
34 lines (26 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from gitlab.base import Base
from gitlab.helper import deprecated
class Keys(Base):
def keys(self, key_id):
"""
Get SSH key with user by ID of an SSH key. Note only administrators can lookup SSH key with user by ID of an
SSH key.
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.keys(1)
:param key_id: The ID of an SSH key
:return: Dictionary containing Key data
"""
return self.get('/keys/{key_id}'.format(key_id=key_id), default_response={})
@deprecated
def getsshkey(self, key_id):
"""
Get a single ssh key identified by key_id
.. warning:: Warning this is being deprecated please use :func:`gitlab.Gitlab.keys`
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.getsshkeys(1)
:param key_id: The ID of an SSH key
:return: Dictionary containing Key data
"""
return self.keys(key_id)