Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PaaS-packages
imperial_doc_materials
Commits
b963dcac
Commit
b963dcac
authored
Nov 24, 2021
by
Alex
Browse files
Add dictionary serialisation methods for storing client in sessions
parent
8128fd78
Changes
2
Hide whitespace changes
Inline
Side-by-side
dist/imperial-doc-materials-0.0.1.tar.gz
View file @
b963dcac
No preview for this file type
src/imperial_doc_materials/client.py
View file @
b963dcac
...
...
@@ -10,6 +10,13 @@ class Materials:
def
__init__
(
self
,
token
:
str
):
self
.
_access_token
=
token
def
get_as_dict
(
self
)
->
dict
:
return
vars
(
self
)
@
staticmethod
def
from_dict
(
client
:
dict
):
return
Materials
(
client
[
"_access_token"
])
@
staticmethod
def
_is_alive
()
->
bool
:
resp
=
requests
.
get
(
f
"
{
MATERIALS_API_STATUS_URL
}
"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment