~unity-2d-team/unity-2d/Shell-MultiMonitor

« back to all changes in this revision

Viewing changes to grackle/client.py

  • Committer: Aaron Bentley
  • Date: 2012-01-10 14:03:53 UTC
  • Revision ID: aaron@canonical.com-20120110140353-njvna2100kp082s7
Use constants.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from httplib import HTTPConnection
 
1
import httplib
2
2
 
3
3
def put_message(archive_name, file_obj):
4
 
    connection = HTTPConnection('localhost', 8435)
 
4
    connection = httplib.HTTPConnection('localhost', 8435)
5
5
    connection.request('POST', 'foo', file_obj.read())
6
6
    response = connection.getresponse()
7
7
    data = response.read()
8
 
    if response.status == 400:
 
8
    if response.status == httplib.BAD_REQUEST:
9
9
        raise Exception('wtf')
10
 
    elif response.status == 200:
 
10
    elif response.status == httplib.CREATED:
11
11
        return
12
12
    else:
13
13
        raise Exception('!!')