Brython: Python for Scripting Webpages

I’ve just discovered Brython a project that let me script webpages using Python instead of JavaScript.

Getting started is really easy:

  1. Import the brython.js library
  2. Add an onload handler to your <body> tag to boot Brython
  3. Write your code inside <script type=”text\python”> tags

Here’s how to use the translate function code from my previous post.

Note that the translation won’t work unless you set up your own account key on the Google Translate API. Drop me a line if you’d like an IP white-listed.

I’m sure there will be gotchas using Brython. I will spend some time investigating further.

One thought on “Brython: Python for Scripting Webpages

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s