Does Jupyter Notebook possess macro functionality (similar to how Excel and Notepad++ have macro recording and playback)? I'd like to automate certain actions I perform a lot (like formatting http requests).
Example:
I paste some unformatted http request headers into a cell:
Host: somehost.com
Accept: text/html,*/*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0)
Gecko/20100101 Firefox/106.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Then a macro would take the data within the cell and format it like so:
somerequest = session.get(
"",
headers = {
'Host': 'somehost.com',
'Accept': 'text/html,*/*',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Connection': 'keep-alive'
})
I know I can achieve this through the creation of a custom Jupyter widget but being able to execute a macro with some designated shortcut would be easier. Having such functionality available across notebooks would also be helpful. Are there any trusted Jupyter extensions I could use to achieve this?