Web


I don’t do a lot of plotting in my job, but I recently heard about a website called Plotly that provides a plotting service for anyone’s data. They even have a plotly package for Python (among others)! So in this article we will be learning how to plot with their package. Let’s have some fun making graphs!

(more…)

One of my readers suggested that I should try logging my data to a web service called Loggly. As I understand it, Loggly is a way to share log data with everyone in a business so that you no longer need to log in to individual machines. They also provide graphs, filters and searches of the logs. They don’t have a Python API, but it’s still pretty easy to send data to Loggly via Pythons urllib2 module and simplejson. Also note that you can use Loggly for 30-day trial period.

(more…)

I’ve been hearing some buzz about a newish web service called Twilio which allows you to send SMS and MMS messages among other things. There’s a handy Python wrapper to their REST API as well. If you sign up with Twilio, they will give you a trial account without even requiring you to provide a credit card, which I appreciated. You will receive a Twilio number that you can use for sending out your messages. Since you are using a trail account, you do have to authorize any phone numbers you want to send messages to before you can actually send a message. Let’s spend some time learning how this works!

(more…)

Last night I received an email about a new Python-related Kickstarter. The Real Python crew added a new author to write a book entirely about Django 1.6. This is a subject that I keep meaning to get into and haven’t had the opportunity to do so. Hopefully by backing this project, I’ll finally learn Django.

I have been impressed with the quality of their previous projects, so I feel that I can safely endorse these authors. I’m sure the project will be of high quality and well worth your time and money. Plus it’s fun to support these guys who want to share their knowledge. If you’re interested in supporting the project you can go to the following address:

http://www.kickstarter.com/projects/721054906/real-python-advanced-web-development-featuring-dja

Note: They are already fully funded at this point and some of the support levels are already full, so if you want to get in early, now is the time!

Today we’ll be looking at how to acquire data from the popular movie site, Rotten Tomatoes. To follow along, you’ll want to sign up for an API key here. When you get your key, make a note of your usage limit, if there is one. You don’t want to do too many calls to their API or you may get your key revoked. Finally, it’s always a very good idea to read the documentation of the API you will be using. Here are a couple of links:

Once you’ve perused that or decided that you’ll save it for later, we’ll continue our journey. (more…)

In this article we will be taking the code from the previous article on Bottle and changing it such that it uses SQLAlchemy instead of just normal SQLite code. This will require you to download the bottle-sqlalchemy package from PyPI. You can also install it using “pip install bottle-sqlalchemy”, assuming you have pip installed. You will also need Bottle itself, of course. Once you’re ready, we can continue. (more…)

Python has lots of web frameworks. Bottle is one of them and is considered a WSGI Framework. It’s also sometimes called a “micro-framework”, probably because Bottle consists of just one Python file and has no dependencies besides Python itself. I’ve been trying to learn it and I was using the official Todo-list tutorial on their website. In this article, we’re going to go over this application and improve the UI a little bit. Then in a separate follow-up article, we’ll change the application to use SQLAlchemy instead of straight sqlite. You will probably want to go install Bottle if you’d like to follow along. (more…)

If you have followed this blog for a while, you may remember that we’ve covered several XML parsing libraries that are included with Python. In this article, we’ll be continuing that series by taking a quick look at the ElementTree library. You will learn how to create an XML file, edit XML and parse the XML. For comparison’s sake, we’ll use the same XML we used in the previous minidom article to illustrate the differences between using minidom and ElementTree. Here is the original XML:

< ?xml version="1.0" ?>
<zappointments reminder="15">
    <appointment>
        <begin>1181251680</begin>        
        <uid>040000008200E000</uid>
        <alarmtime>1181572063</alarmtime>
        <state></state>
        <location></location>
        <duration>1800</duration>
        <subject>Bring pizza home</subject>
    </appointment>
</zappointments>

Now let’s dig into the Python! (more…)

The Python.org website is finally getting a much needed update and at PyCon 2013, they announced that you can now check out a preview of what it’s going to look like here: http://preview.python.org/

There’s a call for beta testers at the bottom of the website, so if you want to help Python, here’s a really simple way for you to do so. They’re still putting content on the site, so it’s going to be kind of rough for a while with placeholders and what-not, but I like the look and feel already. Go check it out for yourself and see what you think!

Today we’ll spend some time looking at three different ways to make Python submit a web form. In this case, we will be doing a web search with duckduckgo.com searching on the term “python” and saving the result as an HTML file. We will use Python’s included urllib modules and two 3rd party packages: requests and mechanize. We have three small scripts to cover, so let’s get cracking! (more…)

Next Page »