Skip to main content

Section 9.10 Python requests Library

In some situations the mbx script will go out on the Internet to fetch some interesting bits for you, saving you the trouble. These include

  • Grabbing, downloading, and organizing stock thumbnails for YouTube videos, using a standard API provided for this purpose. These get used in PDF output in place of embedded videos.
  • WeBWorK problems that are stored on a remote server will give up versions if asked. Again, these are used for PDF output in place of interactive versions.

We use the Python requests module/library to manage the connections to these external servers. There are two items to be aware of.


This library is not available on Apple computers by default. From Alex Jordan comes the following incantation at the command line,

sudo easy_install pip
sudo pip install requests

which was last tested 2017-03-31. Please update us if the situation has changed or there is more to add here.


Using this library to connect to a webserver securely via HTTPS will raise a warning since the support for SSL certificates is not complete. You will see messages similar to

InsecureRequestWarning: Unverified HTTPS request is being made.
Adding certificate verification is strongly advised.

We have not figured out the best way to stop these, as of 2017-04-01.