服务器如何返回429状态,Instagram远程服务器返回一个错误:(429)UNKNOWN STATUS CODE...

博主在使用Instagram API进行批量用户操作时遇到429错误,探讨了过多请求导致的问题,并提供了通过增加延迟来解决请求速率过快的方法。文章详述了如何调整代码以避免频繁请求引发的未知状态码错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我正在使用我自己的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.

+0

https://en.wikipedia.org/wiki/List_of_HTTP_status_codes 429是“请求太多”。这可以帮助你解决你的问题。 –

+0

你我知道有太多的请求如何解决它? –

+0

现在,当我把它设置为睡5秒时,它只遵循前17 –

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值