Instagram The remote server returned an error: (429) UNKNOWN STATUS CODE

孤街浪徒 提交于 2019-12-12 05:48:32

问题


I'm working on some new programs using my own instagram api. Everything is working fine with me except following user script i wanna follow my list of users id so i use this code

        foreach (var item in listBox1.Items)
        {
            WebRequest request = WebRequest.Create("https://api.instagram.com/v1/users/"+item+"/relationship?access_token=" + Common.token2);
            request.Proxy = null;
            request.Method = "POST";
            string postData = "action=follow";
            byte[] byteArray = Encoding.UTF8.GetBytes(postData);
            // Set the ContentType property of the WebRequest.
            request.ContentType = "application/x-www-form-urlencoded";
            // Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length;
            // Get the request stream.
            Stream dataStream = request.GetRequestStream();
            dataStream.Write(byteArray, 0, byteArray.Length);
            dataStream.Close();
            WebResponse response = request.GetResponse();
            // Display the status.
            MessageBox.Show(((HttpWebResponse)response).StatusDescription);
            dataStream.Close();
            response.Close();
            new System.Threading.Thread(GetInfo).Start();
            Thread.Sleep(TimeSpan.FromSeconds(2));
        }
        listBox1.Items.Clear();

it follow first 5 successfully then it return with

The remote server returned an error: (429) UNKNOWN STATUS CODE.


回答1:


The follow API call only allows 20 API calls/hour. After this limit, you will get 429 error

If you implement signed calls then you can do 60 calls/hour.

Here are details of the limits. https://instagram.com/developer/limits/



来源:https://stackoverflow.com/questions/33435965/instagram-the-remote-server-returned-an-error-429-unknown-status-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!