回调URL的格式无效-Instagram API和python请求库 [英] Invalid format for callback url - Instagram API and python requests library

查看:82
本文介绍了回调URL的格式无效-Instagram API和python请求库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码可从网址获取图片

I have the following code to get the images from urls

    params = {'client_id':settings.SOCIAL_AUTH_INSTAGRAM_KEY,
              'client_secret':settings.SOCIAL_AUTH_INSTAGRAM_SECRET,
              'aspect':'media',
              'object_id':instance.hashtag,
              'callback_url':'http://localhost:8000/campaigns/hook'}
    response = requests.post('https://api.instagram.com/v1/subscriptions/', 
                             params=params)

我正在使用请求库来发送发布请求.但是它返回错误信息

I am using the requests library for sending the post request. But It returns the error message

"\" callback_url \的格式无效.URL必须",以\" http:\/\/\或\" https:\/\/\"

"Invalid format for \"callback_url\". URL must","start with \"http:\/\/\" or \"https:\/\/\""

我不知道我是否收到此消息.我正在向请求发送以下网址.

I have no idea i am receiving this message. I am sending the request the following url .

btw http%3A%2F%2F and http:\/\/\

有什么想法吗?

推荐答案

您需要使用data参数发布数据:

You need to use the data parameter to post data:

response = requests.post('https://api.instagram.com/v1/subscriptions/', 
                         data=params)

params关键字仅用于GET参数.

您必须使用可公开访问回调URL; http://localhost不是 Instagram可以访问的URL.

You must use a publicly reachable callback URL; http://localhost is not a URL Instagram can reach.

这篇关于回调URL的格式无效-Instagram API和python请求库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆