Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kort-client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
AlekSIS®
Libraries
kort-client
Compare revisions
91016450b45d60cdb0ddd05e9e8b63776e0427cf to a1d8f89d6c567c7ea8256e2e09f45dc773dfb787
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
AlekSIS/libs/kort-client
Select target project
No results found
a1d8f89d6c567c7ea8256e2e09f45dc773dfb787
Select Git revision
Branches
master
renovate/flake8-7.x
renovate/isort-6.x
renovate/safety-3.x
Swap
Target
AlekSIS/libs/kort-client
Select target project
AlekSIS/libs/kort-client
1 result
91016450b45d60cdb0ddd05e9e8b63776e0427cf
Select Git revision
Branches
master
renovate/flake8-7.x
renovate/isort-6.x
renovate/safety-3.x
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (3)
Fix config validation
· 340aa4e3
Jonathan Weth
authored
1 year ago
Verified
340aa4e3
Merge branch 'master' of edugit.org:hansegucker/kort-client
· 352268f3
Jonathan Weth
authored
1 year ago
Verified
352268f3
Improve logging
· a1d8f89d
Jonathan Weth
authored
1 year ago
Verified
a1d8f89d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
kort_client/api.py
+0
-3
0 additions, 3 deletions
kort_client/api.py
kort_client/run.py
+11
-3
11 additions, 3 deletions
kort_client/run.py
pyproject.toml
+1
-1
1 addition, 1 deletion
pyproject.toml
with
12 additions
and
7 deletions
kort_client/api.py
View file @
a1d8f89d
...
...
@@ -42,7 +42,6 @@ class KortAPI:
def
get_next_job
(
self
,
printer_id
:
int
)
->
Optional
[
dict
[
str
,
Any
]]:
r
=
self
.
_do_request
(
"
GET
"
,
"
next_job
"
,
[
printer_id
])
print
(
r
)
if
r
.
get
(
"
status
"
)
==
"
no_job
"
:
return
None
return
r
...
...
@@ -77,8 +76,6 @@ class KortAPI:
raise
ConfigurationException
(
"
No client_secret set.
"
)
if
not
self
.
settings
.
base_url
:
raise
ConfigurationException
(
"
No base_url set.
"
)
if
not
self
.
settings
.
access_token
:
raise
ConfigurationException
(
"
No access_token set.
"
)
def
_do_request
(
self
,
method
:
str
,
url
:
str
,
attrs
:
Optional
[
Sequence
]
=
None
,
**
kwargs
...
...
This diff is collapsed.
Click to expand it.
kort_client/run.py
View file @
a1d8f89d
...
...
@@ -43,6 +43,9 @@ class PrintClient:
fg
=
"
red
"
,
)
if
self
.
card_detector_in_process
and
self
.
card_detector
:
click
.
secho
(
f
"
Abort card detection process with card detector
{
self
.
card_detector
.
id
}
"
)
self
.
card_detector
.
abort
()
else
:
printer_status
=
"
online
"
...
...
@@ -66,6 +69,9 @@ class PrintClient:
self
.
printer_id
,
"
offline
"
,
"
Printer client was stopped by user.
"
)
if
self
.
card_detector
and
self
.
card_detector_in_process
:
click
.
secho
(
f
"
Abort card detection process with card detector
{
self
.
card_detector
.
id
}
"
)
self
.
card_detector
.
abort
()
raise
...
...
@@ -93,7 +99,6 @@ class PrintClient:
def
step
(
self
):
self
.
printer_config
=
self
.
api
.
get_printer
()
print
(
self
.
printer_config
)
self
.
printer_id
=
self
.
printer_config
[
"
id
"
]
...
...
@@ -102,11 +107,11 @@ class PrintClient:
self
.
card_detector_in_process
=
False
if
self
.
card_detector
:
self
.
interactive
=
self
.
card_detector
.
interactive
click
.
secho
(
f
"
Clear card detector
{
self
.
card_detector
.
id
}
"
)
self
.
card_detector
.
clear
()
next_job
=
self
.
api
.
get_next_job
(
self
.
printer_id
)
print
(
next_job
)
if
next_job
:
job_id
=
next_job
[
"
id
"
]
click
.
secho
(
"
Got new print job {}
"
.
format
(
next_job
),
fg
=
"
green
"
)
...
...
@@ -118,7 +123,9 @@ class PrintClient:
if
not
self
.
printer_config
.
get
(
"
generate_number_on_server
"
):
# Now do something to set the number, but irrelevant for this example
click
.
secho
(
"
Generate number on server disabled
"
,
fg
=
"
yellow
"
)
click
.
secho
(
"
Generate number on server disabled, read chip number
"
,
fg
=
"
yellow
"
)
if
self
.
card_detector
:
self
.
card_detector_in_process
=
True
chip_number
=
self
.
card_detector
.
read_id
()
...
...
@@ -131,6 +138,7 @@ class PrintClient:
raise
KortClientException
(
"
No card detector configured
"
)
if
self
.
with_printer
and
next_job
[
"
card
"
][
"
chip_number
"
]:
click
.
secho
(
"
Download card PDF file ...
"
)
# Download PDF file
with
tempfile
.
NamedTemporaryFile
(
"
wb
"
)
as
f
:
r
=
requests
.
get
(
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
View file @
a1d8f89d
[tool.poetry]
name
=
"kort-client"
version
=
"0.1.
0
"
version
=
"0.1.
1
"
description
=
""
authors
=
[
"Jonathan Weth <git@jonathanweth.de>"
]
...
...
This diff is collapsed.
Click to expand it.