Uploading local data to IPython Notebook Server

I set up an ipython server for other people (in my department) to be able to learn and work with python.

Now I am wondering how people can upload their local data to an ipython laptop session on a remote server. Is there any way to do this?

+5
source share
4 answers

Since you have jupyter installed, all users should see the files / folders in the jupyter launch jupyter , as well as in its subdirectory. The new button on a jupyter laptop can be used to create a new file / folder or even a terminal. Files can be downloaded using the drag and drop function or click here , highlighted below.

enter image description here

+5
source

An alternative way to achieve this with python:

 def jupyter_upload(token, filePath, resourceDstPath, jupyterUrl='http://localhost:8888'): """ Uploads File to Jupyter Notebook Server ---------------------------------------- :param token: The authorization token issued by Jupyter for authentification (enabled by default as of version 4.3.0) :param filePath: The file path to the local content to be uploaded :param resourceDstPath: The path where resource should be placed. The destination directory must exist. :param jupyterUrl: The url to the jupyter server. Default value is typical localhost installation. :return: server response """ import os import base64 import urllib import json import requests dstPath = urllib.quote(resourceDstPath) dstUrl = '%s/api/contents/%s' % (jupyterUrl, dstPath) fileName = filePath[1 + filePath.rfind(os.sep):] headers = {} headers['Authorization'] = 'token '+token with open(filePath, 'r') as myfile: data=myfile.read() b64data=base64.encodestring(data) body = json.dumps({ 'content':b64data, 'name': fileName, 'path': resourceDstPath, 'format': 'base64', 'type':'file' }) return requests.put(dstUrl, data=body, headers=headers, verify=True) 
+3
source

If it is a text file, create an empty file, edit it, and then copy / paste the contents.

You can do this to get around the 25mb limit

0
source

After starting the jupyter laptop jupyter, click new -> Go to terminal , and then just run the following command:

You can transfer your files ** url ** here and get the file uploaded to the server and you are ready to go. Otherwise, directly drag the file or upload the file from the <code> upload </code> button.

You can transfer your url files here and get the file uploaded to the server, and you are ready to go. Otherwise, directly drag the file or upload the file using the upload button.

0
source

All Articles