我有一个基本的应用程序。我使用 twitter api 1.1 和 python。当我在本地运行时,我没有收到任何错误,但在部署后我收到了 DeadlineExceededError 错误。这是日志msj:
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 266, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~tweetllrio/1.370638782538988919/main.py", line 52, in post
''+username+'&max_id='+str(max_id)+'&count=200')
File "libs/oauth2/__init__.py", line 676, in request
uri = req.to_url()
File "libs/oauth2/__init__.py", line 421, in to_url
query = parse_qs(query)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urlparse.py", line 382, in parse_qs
for name, value in parse_qsl(qs, keep_blank_values, strict_parsing):
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urlparse.py", line 423, in parse_qsl
name = unquote(nv[0].replace('+', ' '))
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urlparse.py", line 337, in unquote
if _is_unicode(s):
DeadlineExceededError
这是 main.py
class Search(webapp2.RequestHandler):
def post(self):
username = self.request.get("contenta")
word = self.request.get("contentc")
header, response = client.request(
'https://api.twitter.com/1.1/statuses/user_timeline'
'.json?include_entities=true&screen_name='+username+'&count=1')
name = json.loads(response)[0]["user"]["name"]
image = json.loads(response)[0]["user"]["profile_image_url"]
max_id = json.loads(response)[0]["id"]
count = 0
tweets = []
while count < 18:
header, response = client.request(
'https://api.twitter.com/1.1/statuses/user_timeline'
'.json?include_entities=true&include_rts=false&screen_name='
''+username+'&max_id='+str(max_id)+'&count=200')
for index in range(len(json.loads(response))-1):
if word in json.loads(response)[index]["text"]:
tweets.append(json.loads(response)[index]["text"])
max_id = json.loads(response)[len(json.loads(response))-1]["id"]
count += 1
template = JINJA_ENVIRONMENT.get_template('index.html')
self.response.write(template.render(
{"data": tweets[::-1], "name": name, "image": image, "da":len(tweets)})
)
class MainPage(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('index.html')
self.response.write(template.render({}))
application = webapp2.WSGIApplication([
('/', MainPage),
('/search', Search),
('/add', AddUSer),
], debug=True)
请问你能帮我吗?如果您想查看任何代码,请告诉我。