我正在使用我自己的 instagram api 开发一些新程序。一切对我来说都很好,除了遵循用户脚本我想遵循我的用户 ID 列表,所以我使用这个代码
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个然后它返回
远程服务器返回错误:(429) UNKNOWN STATUS CODE。