Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
github
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
maubot
github
Commits
8017ebd3
You need to sign in or sign up before continuing.
Commit
8017ebd3
authored
3 months ago
by
Tulir Asokan
Browse files
Options
Downloads
Patches
Plain Diff
Fix parsing error responses
parent
79bfdd7f
No related branches found
No related tags found
No related merge requests found
Pipeline
#16160
passed
3 months ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
github/api/client.py
+6
-6
6 additions, 6 deletions
github/api/client.py
github/commands.py
+1
-1
1 addition, 1 deletion
github/commands.py
with
7 additions
and
7 deletions
github/api/client.py
+
6
−
6
View file @
8017ebd3
...
...
@@ -28,10 +28,10 @@ OptStrList = Optional[List[str]]
class
GitHubError
(
Exception
):
def
__init__
(
self
,
message
:
str
,
documentation_url
:
str
,
status
:
int
,
**
kwargs
)
->
None
:
def
__init__
(
self
,
message
:
str
,
documentation_url
:
str
,
status
_code
:
int
,
**
kwargs
)
->
None
:
super
().
__init__
(
message
)
self
.
documentation_url
=
documentation_url
self
.
status
=
status
self
.
status
_code
=
status
_code
self
.
kwargs
=
kwargs
self
.
message
=
message
...
...
@@ -164,7 +164,7 @@ class GitHubClient:
headers
=
self
.
rest_v3_headers
)
data
=
await
resp
.
json
()
if
resp
.
status
!=
200
:
raise
GitHubError
(
status
=
resp
.
status
,
**
data
)
raise
GitHubError
(
status
_code
=
resp
.
status
,
**
data
)
return
Webhook
.
deserialize
(
data
)
async
def
create_webhook
(
self
,
owner
:
str
,
repo
:
str
,
url
:
URL
,
*
,
active
:
bool
=
True
,
...
...
@@ -185,7 +185,7 @@ class GitHubClient:
data
=
json
.
dumps
(
payload
),
headers
=
self
.
rest_v3_headers
)
data
=
await
resp
.
json
()
if
resp
.
status
!=
201
:
raise
GitHubError
(
status
=
resp
.
status
,
**
data
)
raise
GitHubError
(
status
_code
=
resp
.
status
,
**
data
)
return
Webhook
.
deserialize
(
data
)
async
def
edit_webhook
(
self
,
owner
:
str
,
repo
:
str
,
hook_id
:
int
,
*
,
url
:
Optional
[
URL
]
=
None
,
...
...
@@ -219,7 +219,7 @@ class GitHubClient:
data
=
json
.
dumps
(
payload
),
headers
=
self
.
rest_v3_headers
)
data
=
await
resp
.
json
()
if
resp
.
status
!=
200
:
raise
GitHubError
(
status
=
resp
.
status
,
**
data
)
raise
GitHubError
(
status
_code
=
resp
.
status
,
**
data
)
return
Webhook
.
deserialize
(
data
)
async
def
delete_webhook
(
self
,
owner
:
str
,
repo
:
str
,
hook_id
:
int
)
->
None
:
...
...
@@ -229,4 +229,4 @@ class GitHubClient:
)
if
resp
.
status
!=
204
:
data
=
await
resp
.
json
()
raise
GitHubError
(
status
=
resp
.
status
,
**
data
)
raise
GitHubError
(
status
_code
=
resp
.
status
,
**
data
)
This diff is collapsed.
Click to expand it.
github/commands.py
+
1
−
1
View file @
8017ebd3
...
...
@@ -287,7 +287,7 @@ class Commands:
try
:
await
client
.
delete_webhook
(
*
repo
,
hook_id
=
webhook_info
.
github_id
)
except
GitHubError
as
e
:
if
e
.
status
==
404
:
if
e
.
status
_code
==
404
:
await
evt
.
reply
(
"
Webhook deleted successfully
"
)
return
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment