【发布时间】:2015-06-29 12:15:33
【问题描述】:
我需要在 heroku 中运行这个脚本来更新我的数据库。数据是从我的 facebook 帖子中检索的。
我不知道如何使用 Heroku 调度程序,我该怎么办?
from facepy import GraphAPI
import json
#import psycopg2
#import mysql.connector
my_token = ....
graph = GraphAPI(my_token)
# Get my latest posts
my_posts = graph.get("me?fields=posts.limit(1){message}", page=False, retry=1, limit=1)
with open('content.json', 'w') as outfile:
json.dump(my_posts, outfile, indent = 4)
with open('content.json') as data_file:
da = json.load(data_file)
a = da["posts"]["data"][0]["message"]
#fecha = da["posts"]["data"][0]["created_time"]
b=a[0:4]
if b == 'Temp':
temp = a[5:7]
hum = a[13:15]
id = a[20:23]
print temp
print hum
print indent
else:
print 'error'
谢谢
【问题讨论】:
标签: python heroku scheduled-tasks job-scheduling