Book Image

Maya Programming with Python Cookbook

By : Adrian Herbez
Book Image

Maya Programming with Python Cookbook

By: Adrian Herbez

Overview of this book

Maya is a 3D graphics and animation software, used to develop interactive 3D applications and games with stupendous visual effects. The Maya Programming with Python Cookbook is all about creating fast, powerful automation systems with minimum coding using Maya Python. With the help of insightful and essential recipes, this book will help you improve your modelling skills. Expand your development options and overcome scripting problems encountered whilst developing code in Maya. Right from the beginning, get solutions to complex development concerns faced when implementing as parts of build.
Table of Contents (17 chapters)
Maya Programming with Python Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Grabbing data from a server


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.

Getting ready

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...