brian arita
  Helping The Community Find Answers

Utilities

Next To Be Added

VIM - Vi IMproved

WSGI - The Coolest Thing About Python

This is a basic WSGI application which interfaces with an external server.



#!/usr/bin/python

import random
import re
import sys
import urllib
import urllib2
from pprint import pformat

def application(environ, start_response):

    status = '200 OK'
    output = 'Output'
        try:
           # Setup form again 
           formData = urllib.urlencode({'key1': 'string1', 'key2': 'string22'})
           request = urllib2.Request('http://www.example.com/form.php")
           response = urllib2.urlopen(request, formData)
           output += response.read()
        except:
            # For Debugging 
            e = sys.exc_info()[1]
            output += pformat(e)

    response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

Rackspace Cloud Files

This is a command line based script that manages the containers and files within your cloud account.

Copyright © 2009. BrianArita.Com.