File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -488,6 +488,7 @@ RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.c
488488ENV PYTHONUSERBASE "/root/.local"
489489ADD patches/kaggle_gcp.py /root/.local/lib/python3.7/site-packages/kaggle_gcp.py
490490ADD patches/kaggle_secrets.py /root/.local/lib/python3.7/site-packages/kaggle_secrets.py
491+ ADD patches/kaggle_session.py /root/.local/lib/python3.7/site-packages/kaggle_session.py
491492ADD patches/kaggle_web_client.py /root/.local/lib/python3.7/site-packages/kaggle_web_client.py
492493ADD patches/kaggle_datasets.py /root/.local/lib/python3.7/site-packages/kaggle_datasets.py
493494ADD patches/log.py /root/.local/lib/python3.7/site-packages/log.py
Original file line number Diff line number Diff line change 1+ """
2+ This library adds support for retrieving data related to the current user session.
3+ """
4+
5+ import os
6+
7+ from kaggle_web_client import KaggleWebClient
8+
9+
10+ class UserSessionClient ():
11+ GET_SOURCE_ENDPOINT = '/requests/GetKernelRunSourceForCaipRequest'
12+
13+ def __init__ (self ):
14+ self .web_client = KaggleWebClient ()
15+
16+ def get_exportable_ipynb (self ):
17+ """Fetch the .ipynb source of the current notebook session.
18+
19+ If Kaggle datasets are attached to the notebook, the source will
20+ include an additonnal cell with logic to download the datasets
21+ outside the Kaggle platform.
22+ """
23+ request_body = {
24+ 'UseDraft' : True ,
25+ }
26+ return self .web_client .make_post_request (request_body , self .GET_SOURCE_ENDPOINT )
You can’t perform that action at this time.
0 commit comments