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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
stgroup
misc
CodiMD export script
Commits
49b317d4
Commit
49b317d4
authored
Feb 3, 2023
by
Martin Morgenstern
Browse files
Options
Downloads
Patches
Plain Diff
Improve the robustness of the prompt (especially on Windows)
parent
a034abc5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
codimd_export.py
+10
-6
10 additions, 6 deletions
codimd_export.py
with
11 additions
and
7 deletions
README.md
+
1
−
1
View file @
49b317d4
...
...
@@ -25,7 +25,7 @@ Now, the instructions are similar for Chrome and Firefox:
3.
**Chrome**
: go to the "Application" tab.
**Firefox**
: go to the "Storage" tab ("Web-Speicher").
4.
Un-collapse "Cookies".
5.
In the list, search for a cookie with the name
`connect.sid`
6.
Select and copy the value.
6.
Select and copy the value.
It must start with the character sequence
`s%3A`
.
### 2. Execute the script via the command line
...
...
This diff is collapsed.
Click to expand it.
codimd_export.py
+
10
−
6
View file @
49b317d4
...
...
@@ -4,13 +4,17 @@ Save all Markdown documents in your CodiMD history to a local directory.
"""
import
json
import
os
import
sys
from
getpass
import
getpass
from
pathlib
import
Path
from
urllib.error
import
HTTPError
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
def
slurp
(
url
,
session_id
):
"""
Retrieve a (protected) CodiMD resource and return it as a bytes object.
"""
...
...
@@ -56,10 +60,10 @@ def main(instance_url, session_id, export_to):
def
get_sessionid
():
"""
Ask the user for the session id, if it
'
s not configured as an envvar.
"""
try
:
return
os
.
environ
[
"
CMD_SESSIONID
"
]
except
KeyError
:
r
eturn
getpass
(
"
Please provide your CodiMD session id (connect.sid cookie):
"
)
sid
=
getpass
(
"
Please provide your CodiMD session id (connect.sid cookie):
"
)
if
sid
.
startswith
(
"
s%3A
"
):
return
sid
r
aise
SystemExit
(
f
"
error: the supplied session id seems to be malformed
"
)
if
__name__
==
"
__main__
"
:
...
...
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