The Jupyter notebooks in the downloads for the Flask example have single quotes around the form data for the POST and PUT operations. Since !curl is executed in the underlying shell, one should not use single quotes as different shells can interpret those differently in general, and specifically in the context of curl.
I kept getting Bad Request 400 responses when I tried to execute the POST and PUT cells in my local Jupyter environment which is launched on top of Git Bash, a fairly typical bash implmentation.
While:
-d â{âusernameâ:âtestuserâ,âpasswordâ:âsecurepasswordâ}â
works in the Coursera notebook environments, it fights with many underlying shells.
Using double quotes throughout and escaping the payload ones will reliably work in all underlying shells. So, I strongly suggest you alter the notebook cells to:
-d â{\âusername\â:\âtestuser\â,\âpassword\â:\âsecurepassword\â}â
to avoid confusion for students who choose to use their own environments.
On the plus side, I was able to use Chat GPT 4o to guide my analysis when things worked fine from Postman but always through errors with !curl in the provided notebook in my local Jupyter environment.
(NOTE: I had to use double backslashes in the second syntax example above to get them to render properly for people reading the post. The actual implementation only requires one backslash to escape the double quotes.)