Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
documento-printserver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Documento
documento-printserver
Commits
fefda706
Verified
Commit
fefda706
authored
3 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Don't fail directly on connection error
parent
c679843e
No related branches found
No related tags found
1 merge request
!17
Resolve "Don't stop if there is only a single connection error"
Pipeline
#20875
passed
3 years ago
Stage: test
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
documento_printserver/print_server.py
+18
-13
18 additions, 13 deletions
documento_printserver/print_server.py
with
18 additions
and
13 deletions
documento_printserver/print_server.py
+
18
−
13
View file @
fefda706
...
@@ -74,19 +74,24 @@ categories_url = base_url + "/api/categories/"
...
@@ -74,19 +74,24 @@ categories_url = base_url + "/api/categories/"
def
print_server
():
def
print_server
():
while
True
:
while
True
:
# Get auth token
try
:
r
=
requests
.
post
(
# Get auth token
login_url
,
r
=
requests
.
post
(
json
=
{
login_url
,
"
username
"
:
settings
.
get
(
"
server.username
"
),
json
=
{
"
password
"
:
settings
.
get
(
"
server.password
"
),
"
username
"
:
settings
.
get
(
"
server.username
"
),
},
"
password
"
:
settings
.
get
(
"
server.password
"
),
)
},
token
=
r
.
json
()[
"
token
"
]
)
headers
=
{
"
Authorization
"
:
f
"
Token
{
token
}
"
}
token
=
r
.
json
()[
"
token
"
]
headers
=
{
"
Authorization
"
:
f
"
Token
{
token
}
"
}
# Fetch print jobs
jobs
=
requests
.
get
(
jobs_url
,
headers
=
headers
).
json
()
# Fetch print jobs
jobs
=
requests
.
get
(
jobs_url
,
headers
=
headers
).
json
()
except
requests
.
exceptions
.
ConnectionError
:
print
(
"
Fetching latest jobs failed due to a connection error.
"
)
time
.
sleep
(
3
)
continue
# Fetch categories
# Fetch categories
categories
=
requests
.
get
(
categories_url
,
headers
=
headers
).
json
()
categories
=
requests
.
get
(
categories_url
,
headers
=
headers
).
json
()
...
...
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