In this example, we'll look at the simplest possible way to grab data from a given URL, using Python's built-in urllib2
library.
You'll want to make sure that you have a URL to grab. You can use any website you like, but for the sake of testing, it can be helpful to have a minimal page served on your local machine. If you want to do that, start by creating a simple html file, something like the following:
<html> <head> <title> Maya scripting chapter 9 </title> </head> <body> HELLO FROM THE WEB </body> </html>
Once you've done that, you'll want to have that served as a page on your own machine. Python offers a really simple way to do just that. Open a command line (terminal on a mac) and navigate to wherever you saved your html file. From there, enter the following command:
python -m SimpleHTTPServer
This will cause Python to serve the contents of the current...