0
我正在使用我自己的instagram api開發一些新程序。 一切都與我工作正常,除了以下的用戶腳本 我想按照我的用戶ID 的名單,所以我用這個代碼Instagram遠程服務器返回一個錯誤:(429)UNKNOWN STATUS 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();
它遵循前5成功然後將其與
The remote server returned an error: (429) UNKNOWN STATUS CODE.
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes 429是「請求太多」。這可以幫助你解決你的問題。 – JamesT
你我知道有太多的請求如何解決它? – KingDollar
現在,當我把它設置爲睡5秒時,它只遵循前17 – KingDollar