Yandex Maps返回403禁止使用改造 [英] Yandex Maps return 403 Forbidden using retrofit
本文介绍了Yandex Maps返回403禁止使用改造的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我将此链接称为 https://geocode- maps.yandex.ru/1.x/?format=json&geocode=astana 在我的浏览器上可以正常工作,但是当我使用改造功能调用它时,系统却显示403 Forbidden
When I call this link https://geocode-maps.yandex.ru/1.x/?format=json&geocode=astana on my browser it works, but when I call it using retrofit It gives me 403 Forbidden
我的代码是
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(Settings.YANDEX_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();
return retrofit.create(YandexService.class);
public final static String YANDEX_URL = "https://geocode-maps.yandex.ru/1.x";
我用这个叫它
@GET("/")
Call<YandexResponse> getGeoCollection(@Query("format") String format, @Query("geocode") String geocode);
还有这个
@Override
public void getMapLocation() {
Call<YandexResponse> call = dataProvider.yandexSearch("Astana");
call.enqueue(new Callback<YandexResponse>() {
@Override
public void onResponse(Response<YandexResponse> response, Retrofit retrofit) {
}
@Override
public void onFailure(Throwable t) {
Alert.showDefaultAlert(baseActivity);
t.printStackTrace();
}
});
}
为什么给我403 Forbidden,它不需要任何授权...
Why it gives to me 403 Forbidden, it doesn't need any authorization...
推荐答案
我只是将/1.x/
从YANDEX_URL粘贴到服务
I Just paste /1.x/
from YANDEX_URL to Service
成为此人
public final static String YANDEX_URL = "https://geocode-maps.yandex.ru";
@GET("/1.x/")
Call<YandexResponse> getGeoCollection(@Query("format") String format,
@Query("geocode") String geocode);
这篇关于Yandex Maps返回403禁止使用改造的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文