Thanks so much for sharing this! I had never looked at this sort of thing before so I’ve learned a ton. Here’s a very rough modification of your code that prompts for username+password+2FA (if necessary) and can perform simple notebook download / upload:
This is very much beginner code, so feel free to suggest changes or improvements!
It seems that you can upload a full notebook using the /document/new
endpoint, so that’s what I went with. Though the edit
websocket has been pretty fun to play around with too…
Edit: Here’s a utility script which takes a downloaded notebook JSON file and outputs a new file where the cells are reindexed so that they go from 0,1,… to # cells - 1.