Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
789 views
in Technique[技术] by (71.8m points)

python - Cron works on local host but not when deployed Appengine

I have a cron job in python that works on my localhost but when it is deployed to appengine, it no longer works.

  pl = db.Query(Venue).order("id")
    list = pl.fetch(limit=0)
    for p in pl:
        base_url = 'http://search.twitter.com/search.json?rpp=100&q=4sq.com/'
        query = p.twitter_ID
        url_string = base_url + query
        json_text = fetch(url_string)
        json_response = simplejson.loads(json_text.content) 
        result = json_response['results']
        for f in result:
            user = f['from_user'] 
            print user   

This works fine locally but on the server I get the following error:

'results' Traceback (most recent call last): File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/init.py", line 515, in call handler.get(*groups) File "/base/data/home/apps/hoosheer/4.347697940058059704/hoosheer_main.py", line 199, in get result = json_response['results'] KeyError: 'results'

This did work until I deployed my second version. Is there any way I can fix this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...