mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 19:31:10 +00:00
Factorize checking of status
This commit is contained in:
+2
-4
@@ -30,13 +30,12 @@ class UserKey( GithubObject.GithubObject ):
|
||||
return self._NoneIfNotSet( self._verified )
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self._request(
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"DELETE",
|
||||
self.url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, title = GithubObject.NotSet, key = GithubObject.NotSet ):
|
||||
assert title is GithubObject.NotSet or isinstance( title, ( str, unicode ) ), title
|
||||
@@ -46,13 +45,12 @@ class UserKey( GithubObject.GithubObject ):
|
||||
post_parameters[ "title" ] = title
|
||||
if key is not GithubObject.NotSet:
|
||||
post_parameters[ "key" ] = key
|
||||
status, headers, data = self._request(
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def _initAttributes( self ):
|
||||
|
||||
Reference in New Issue
Block a user