我正在用芹菜做一些工作。下面是用python编写的芹菜任务:
@celery.task
def getOrders():
r = requests.get('http://localhost:4000/generate-orders/get-orders')
print r下面是我的节点js代码,它调用上面定义的芹菜任务:
var schedule = require('node-schedule');
var celery = require('../celery'),
client = celery.createClient({
CELERY_BROKER_URL: 'amqp://guest:guest@localhost:5672//'
});
client.on('error', function(err) {
console.log(err);
});
/*client.on('connect', function() {
client.call('tasks.every_30_seconds');
});*/
client.on('connect', function() {
console.log('hi');
var j = schedule.scheduleJob('*/3 * * * *', function(){
console.log('Today is recognized by Rebecca Black!');
client.call('tasks.getOrders');
});
});正如上面的代码所写的,每隔3分钟,我就会使用节点调度包定期调用芹菜任务。
但是requests.get给出了错误:
ProxyError: None:最大重试超过url:http://localhost:4000/generate-orders/get-orders
这是什么原因?
发布于 2017-03-17 09:40:23
请编写一个python脚本在机器的命令行上运行。
import requests
r = requests.get('http://localhost:4000/generate-orders/get-orders')
print(r.text)如果这也失败了,那么这个http端点就会出现问题。
https://stackoverflow.com/questions/42853590
复制相似问题