Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用python Instagram接收实时Instagram更新?_Python_Flask_Instagram - Fatal编程技术网

如何使用python Instagram接收实时Instagram更新?

如何使用python Instagram接收实时Instagram更新?,python,flask,instagram,Python,Flask,Instagram,我只是想知道如何从 它实际上是一个Flask应用程序,托管在Google云VM中。到现在为止,一直都还不错。我可以订阅特定的标签或用户。我想instagram会把更新发布到我的服务器上 173.252.105.114 - - [19/Oct/2015:01:40:52 -0400] "POST /hook/instagram HTTP/1.1" 301 517 "-" "Python-httplib2/0.8 (gzip)" 173.252.108.115 - - [19/Oct/2015:01

我只是想知道如何从

它实际上是一个Flask应用程序,托管在Google云VM中。到现在为止,一直都还不错。我可以订阅特定的
标签
用户
。我想instagram会把更新发布到我的服务器上

173.252.105.114 - - [19/Oct/2015:01:40:52 -0400] "POST /hook/instagram HTTP/1.1" 301 517 "-" "Python-httplib2/0.8 (gzip)"
173.252.108.115 - - [19/Oct/2015:01:40:53 -0400] "POST /hook/instagram HTTP/1.1" 301 517 "-" "Python-httplib2/0.8 (gzip)"
173.252.108.119 - - [19/Oct/2015:01:41:31 -0400] "POST /hook/instagram HTTP/1.1" 301 517 "-" "Python-httplib2/0.8 (gzip)"
173.252.113.116 - - [19/Oct/2015:01:41:41 -0400] "POST /hook/instagram HTTP/1.1" 301 517 "-" "Python-httplib2/0.8 (gzip)"
所以我想使用反应器是最好的接收方式,我做了这样的事情

""" Hook for real time update """
def process_tag_update(update):
    new = RealUpdate(update['subscription_id'], updata['object_id'], update['object'])
    db.session.add(new)
    db.session.commit()
    print 'Received a push: '

reactor = subscriptions.SubscriptionsReactor()
reactor.register_callback(subscriptions.SubscriptionType.TAG, process_tag_update)
钩子url处理

@app.route('/hook/instagram/',methods=['GET', 'POST'])
def hook_instagram():
    if request.method == 'POST':
        # POST event is used to for the events notifications
        x_hub_signature = request.headers.get('X-Hub-Signature')
        raw_response = request.data
        try:
            reactor.process(CLIENT_SECRET, raw_response, x_hub_signature)
        except subscriptions.SubscriptionVerifyError:
            print 'Signature mismatch'
        return 'done'
    else:
        hub_challenge =  request.args.get('hub.challenge')
        return '{}'.format(hub_challenge)
但我不知道这是不是正确的方式。。。我看不清
过程\u标记\u更新(update)
会带来什么,因为

  • 我不会打印
  • 我无法调试

  • 有没有人遇到过类似的问题?如何克服这个问题。?如果您有任何想法要实现,请告诉我。

    问题是
    301
    重定向。您必须确保您的实时回调URL以
    /


    示例:-
    /hook/instagram/

    我在instagram应用程序nodejs上遇到了问题,instagram一直在发送301 http代码,因为url结尾缺少“/”,通过检查我现在可以重新爱上它,非常感谢。向上投票。