Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

deal with the incorrent id & version 5.

  • Loading branch information...
commit 7fa33b646dcff47c3eb9db1a61f547e29e8f7f03 1 parent c23158f
@ydoovv ydoovv authored
Showing with 9 additions and 2 deletions.
  1. +1 −1  app.yaml
  2. +8 −1 main.py
View
2  app.yaml
@@ -1,5 +1,5 @@
application: digest-favs
-version: 4
+version: 5
runtime: python
api_version: 1
View
9 main.py
@@ -4,6 +4,7 @@
import os
import re
+import logging
from google.appengine.ext import db
from google.appengine.ext import webapp
@@ -39,7 +40,13 @@ def get(self):
proxy = 'http://ydoovv.appspot.com/' # a twitter api proxy, or handle yourself
url = '%s/favorites/%s.json?page=%s' % (proxy, id_, page)
res = urlfetch.fetch(url)
- favs = json.loads(res.content)
+ if res.content[0] not in ('[', '{'):
+ logging.error('BAD_FETCH: %s' % url)
+ template_values["flashes"] = 'Bad request!'
+ self.render(template_values)
+ return
+ else:
+ favs = json.loads(res.content)
if isinstance(favs, dict): # {"request": "oooo", "error": "xxxx"}
template_values["flashes"] = favs["error"]
self.render(template_values)
Please sign in to comment.
Something went wrong with that request. Please try again.