Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- from ActionCheckIn import ActionCheckIn
- from urlparse import urlparse
- import psycopg2
- import sys
- commands = {
- 'checkIn': ActionCheckIn,
- }
- conn = psycopg2.connect("dbname=thumbtack_crawler user=journey4712 password=abcde")
- def myapp(environ, start_response):
- query_string = []
- try:
- query_string = urlparse.parse_qs(environ["QUERY_STRING"])
- except:
- pass
- if "r" not in query_string:
- start_response('404 Not Found', [('Content-Type', 'text/plain')])
- return ['Route not specified\n']
- elif query_string["r"] not in commands:
- start_response('404 Not Found', [('Content-Type', 'text/plain')])
- return ['Route not available\n']
- start_response('200 OK', [('Content-Type', 'text/plain')])
- return [repr(type(query_string))+'\nHello World!\n']
- if __name__ == '__main__':
- from wsgiref.simple_server import make_server
- make_server('', 4321, myapp).handle_request()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement