Java 在Android中使用截击时出现意外响应代码429?

Java 在Android中使用截击时出现意外响应代码429?,java,android,http,android-volley,Java,Android,Http,Android Volley,我能够在几分钟内从URL获取JSON信息,但最终它会给我“意外响应代码429”。链接来自Steam,我想知道这是凌空抽射还是Steam的问题?这是我当前的实现,因为我可能在代码中遗漏了一些东西 RequestQueue queue = Volley.newRequestQueue(this); // Request a string response from the provided URL. JsonObjectRequest stringR

我能够在几分钟内从URL获取JSON信息,但最终它会给我“意外响应代码429”。链接来自Steam,我想知道这是凌空抽射还是Steam的问题?这是我当前的实现,因为我可能在代码中遗漏了一些东西

RequestQueue queue = Volley.newRequestQueue(this);

            // Request a string response from the provided URL.
            JsonObjectRequest stringRequest = new JsonObjectRequest(Request.Method.GET, retrievalURL, null,
                    new Response.Listener<JSONObject>() {
                        @Override
                        public void onResponse(JSONObject response) {
                            try {
                               int indexOfWear = listOfWears.indexOf(wear);
                                Map<String, String> itemInList = listWearsAndPrices.get(indexOfWear);
                                if (response.getBoolean("success")) {
                                    itemInList.put("Price", response.getString("lowest_price"));
                                } else {
                                    // If price is not possible
                                    itemInList.put("Price", "Item Unavailable");
                                    Log.e("tag", "Item unavailable unreached");
                                }
                                // Update view
                                adapter.notifyDataSetChanged();
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }


                    }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    /**
                     * TODO
                     * CHECK FOR INTERNET CONNECTION
                     */
                    int indexOfWear = listOfWears.indexOf(wear);
                    Map<String, String> itemInList = listWearsAndPrices.get(indexOfWear);
                    itemInList.put("Price", "Item Unavailable");
                    adapter.notifyDataSetChanged();
                }
            });
            // Add the request to the RequestQueue.
            queue.add(stringRequest);
RequestQueue queue=Volley.newRequestQueue(this);
//从提供的URL请求字符串响应。
JsonObjectRequest stringRequest=新的JsonObjectRequest(Request.Method.GET,retrievalURL,null,
新的Response.Listener(){
@凌驾
公共void onResponse(JSONObject响应){
试一试{
int indexOfWear=listofwear.indexOf(磨损);
Map itemInList=listwarsandprices.get(indexOfWear);
if(response.getBoolean(“success”)){
itemInList.put(“价格”,response.getString(“最低价格”);
}否则{
//如果价格不可能的话
itemInList.put(“价格”、“项目不可用”);
Log.e(“标签”,“无法获取的项目”);
}
//更新视图
adapter.notifyDataSetChanged();
}捕获(JSONException e){
e、 printStackTrace();
}
}
},new Response.ErrorListener(){
@凌驾
公共无效onErrorResponse(截击错误){
/**
*待办事项
*检查互联网连接
*/
int indexOfWear=listofwear.indexOf(磨损);
Map itemInList=listwarsandprices.get(indexOfWear);
itemInList.put(“价格”、“项目不可用”);
adapter.notifyDataSetChanged();
}
});
//将请求添加到RequestQueue。
添加(stringRequest);

429响应代码表示

Too Many Requests

The user has sent too many requests in a given amount of time ("rate limiting").

您尝试点击的api可能仅限于您在一天或一定时间内可以点击的次数。

在点击该服务之前,您是否检查了internet连接?