Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
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
Martin Mareš
Odevzdávací Systém MO
Merge requests
!138
Zpracování nedoručenek
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Zpracování nedoručenek
dsn
into
devel
Overview
0
Commits
35
Changes
44
Merged
Martin Mareš
requested to merge
dsn
into
devel
4 months ago
Overview
0
Commits
35
Changes
44
Expand
Implementace zbytku Issue
#116 (closed)
.
0
0
Merge request reports
Compare
devel
version 6
836f63c5
4 months ago
version 5
2fe6ec66
4 months ago
version 4
6e74bd8e
4 months ago
version 3
1f5cfd6b
4 months ago
version 2
ded02d2d
4 months ago
version 1
6e26635a
4 months ago
devel (base)
and
latest version
latest version
8dc000d4
35 commits,
4 months ago
version 6
836f63c5
48 commits,
4 months ago
version 5
2fe6ec66
46 commits,
4 months ago
version 4
6e74bd8e
43 commits,
4 months ago
version 3
1f5cfd6b
35 commits,
4 months ago
version 2
ded02d2d
34 commits,
4 months ago
version 1
6e26635a
33 commits,
4 months ago
44 files
+
880
−
88
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
44
Search (e.g. *.vue) (Ctrl+P)
bin/send-dsn
+
22
−
3
Options
@@ -2,21 +2,40 @@
# Tento skript se volá při doručování pošty (například pomocí "execute" v Sieve)
# a předá mail webové části OSMO přes /api/email-dsn.
import
os
from
pathlib
import
Path
import
requests
from
requests.exceptions
import
RequestException
import
sys
if
len
(
sys
.
argv
)
!=
2
:
print
(
'
Arguments: <URL of OSMO root>
/
'
,
file
=
sys
.
stderr
)
print
(
'
Arguments: <URL of OSMO root>
'
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
osmo_url
=
sys
.
argv
[
1
]
mail
=
sys
.
stdin
.
buffer
.
read
()
key_path
=
Path
.
home
()
/
'
.config/osmo/dsn-api-key
'
try
:
reply
=
requests
.
post
(
f
'
{
osmo_url
}
api/email-dsn
'
,
data
=
mail
,
timeout
=
30
)
except
RequestException
:
with
key_path
.
open
()
as
f
:
key
=
f
.
readline
().
strip
()
if
key
==
""
:
print
(
f
'
Cannot read key from
{
key_path
}
'
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
except
OSError
as
e
:
print
(
f
'
Cannot read
{
key_path
}
:
{
e
}
'
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
try
:
reply
=
requests
.
post
(
os
.
path
.
join
(
osmo_url
,
'
api/email-dsn
'
),
data
=
mail
,
headers
=
{
'
Authorization
'
:
f
'
Bearer
{
key
}
'
},
timeout
=
30
)
except
RequestException
as
e
:
print
(
f
'
Error sending DSN:
{
e
}
'
)
sys
.
exit
(
1
)
if
reply
.
status_code
!=
200
:
print
(
f
'
Error sending DSN: HTTP status
{
reply
.
status_code
}
'
)
sys
.
exit
(
1
)
Loading