Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CodiMD export script
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
stgroup
misc
CodiMD export script
Commits
8dbbed1e
Commit
8dbbed1e
authored
2 years ago
by
Andreas Domanowski
Browse files
Options
Downloads
Patches
Plain Diff
Extract cookie prompt
parent
3a941074
No related branches found
No related tags found
1 merge request
!1
Hedgedoc import
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
codimd_export.py
+1
-14
1 addition, 14 deletions
codimd_export.py
common.py
+15
-0
15 additions, 0 deletions
common.py
with
16 additions
and
14 deletions
codimd_export.py
+
1
−
14
View file @
8dbbed1e
...
...
@@ -4,17 +4,12 @@ Save all Markdown documents in your CodiMD history to a local directory.
"""
import
json
import
sys
from
pathlib
import
Path
from
urllib.error
import
HTTPError
from
urllib.parse
import
quote
from
urllib.request
import
Request
,
urlopen
if
not
sys
.
platform
.
startswith
(
"
win
"
):
from
getpass
import
getpass
else
:
# on Windows, Ctrl-V doesn't work with getpass()
getpass
=
input
from
common
import
get_sessionid
def
slurp
(
url
,
session_id
):
...
...
@@ -59,13 +54,5 @@ def main(instance_url, session_id, export_to):
print
(
f
"
Done:
{
num_ok
}
notes successfully downloaded,
{
num_fail
}
not accessible.
"
)
def
get_sessionid
():
"""
Ask the user for the session id, if it
'
s not configured as an envvar.
"""
sid
=
getpass
(
"
Please provide your CodiMD session id (connect.sid cookie):
"
)
if
sid
.
startswith
(
"
s%3A
"
):
return
sid
raise
SystemExit
(
f
"
error: the supplied session id seems to be malformed
"
)
if
__name__
==
"
__main__
"
:
main
(
"
https://md.inf.tu-dresden.de
"
,
get_sessionid
(),
"
codimd-documents
"
)
This diff is collapsed.
Click to expand it.
common.py
0 → 100644
+
15
−
0
View file @
8dbbed1e
import
sys
if
not
sys
.
platform
.
startswith
(
"
win
"
):
from
getpass
import
getpass
else
:
# on Windows, Ctrl-V doesn't work with getpass()
getpass
=
input
def
get_sessionid
():
"""
Ask the user for the session id, if it
'
s not configured as an envvar.
"""
sid
=
getpass
(
"
Please provide your CodiMD session id (connect.sid cookie):
"
)
if
sid
.
startswith
(
"
s%3A
"
):
return
sid
raise
SystemExit
(
f
"
error: the supplied session id seems to be malformed
"
)
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