Skip to content
This repository
Browse code

Added Sandbox controller

  • Loading branch information...
commit 8e1c7a2034aae031590f5544ad20cbcf3d24a3f0 1 parent 7f47983
Gleb Popov authored

Showing 1 changed file with 31 additions and 0 deletions. Show diff stats Hide diff stats

  1. +31 0 SandboxController.py
31 SandboxController.py
... ... @@ -0,0 +1,31 @@
  1 +#!/usr/bin/env python
  2 +#
  3 +# Hacker News Droid API: returns best articles in JSON or XML using HTML Parser
  4 +# Gleb Popov. September 2011
  5 +#
  6 +
  7 +import os
  8 +import re
  9 +import logging
  10 +from UserString import MutableString
  11 +from django.utils import simplejson
  12 +from google.appengine.ext import webapp
  13 +from google.appengine.ext import db
  14 +from google.appengine.ext.webapp import util
  15 +import Formatter
  16 +import AppConfig
  17 +import GAHelper
  18 +from xml.sax.saxutils import escape
  19 +import APIUtils
  20 +import GAHelper
  21 +from BeautifulSoup import BeautifulSoup
  22 +from google.appengine.api import urlfetch
  23 +
  24 +class HackerNewsSandboxHandler(webapp.RequestHandler):
  25 + def get(self):
  26 + try:
  27 + result = urlfetch.fetch(url=AppConfig.hackerNewsURL, deadline=30)
  28 + self.response.out.write(result.status_code)
  29 + self.response.out.write(result.content)
  30 + except:
  31 + self.response.out.write('unable to get data')

0 comments on commit 8e1c7a2

Please sign in to comment.
Something went wrong with that request. Please try again.