Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webarchive-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
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
labs-team
webarchive-api
Commits
ab353b70
Commit
ab353b70
authored
1 year ago
by
onbpre
Browse files
Options
Downloads
Patches
Plain Diff
Replace all HTTP 403 codes with 401 codes for more appropriate authorization handling
parent
5f4b3b05
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webarchiv.py
+3
-3
3 additions, 3 deletions
webarchiv.py
with
3 additions
and
3 deletions
webarchiv.py
+
3
−
3
View file @
ab353b70
...
...
@@ -111,7 +111,7 @@ class WebarchivSession:
@staticmethod
def
_handle_response_errors
(
r
):
if
r
.
status_code
==
40
3
:
if
r
.
status_code
==
40
1
:
print
(
'
Forbidden. Invalid Token or ApiKey transmitted
'
,
file
=
sys
.
stderr
)
return
r
elif
r
.
status_code
==
400
:
...
...
@@ -125,7 +125,7 @@ class WebarchivSession:
r
=
requests
.
get
(
self
.
base_url
.
format
(
op
),
**
kwargs
)
if
r
.
ok
:
return
r
elif
r
.
status_code
==
40
3
and
auto_connect
:
elif
r
.
status_code
==
40
1
and
auto_connect
:
self
.
connect
()
kwargs
[
'
headers
'
]
=
{
'
Authorization
'
:
'
Bearer
'
+
self
.
token
...
...
@@ -155,7 +155,7 @@ class WebarchivSession:
r
=
requests
.
post
(
self
.
base_url
.
format
(
op
),
json
=
json
,
**
kwargs
)
if
r
.
status_code
==
201
:
return
r
elif
r
.
status_code
==
40
3
and
auto_connect
:
elif
r
.
status_code
==
40
1
and
auto_connect
:
self
.
connect
()
return
self
.
_post
(
op
,
False
,
json
,
**
kwargs
)
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