Yandex Maps return 403 禁止使用改造
Yandex Maps return 403 Forbidden using retrofit
当我在我的浏览器上调用它时 link https://geocode-maps.yandex.ru/1.x/?format=json&geocode=astana 它有效,但是当我使用改造调用它时它给了我 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,不需要任何授权...
我只是将 YANDEX_URL 中的 /1.x/
粘贴到服务
变成这个
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);
当我在我的浏览器上调用它时 link https://geocode-maps.yandex.ru/1.x/?format=json&geocode=astana 它有效,但是当我使用改造调用它时它给了我 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,不需要任何授权...
我只是将 YANDEX_URL 中的 /1.x/
粘贴到服务
变成这个
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);