mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[surepetcare] Adapt blocked user agent (#15047)
* Adapt blocked user agent Fixes #15046 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
43d35538d5
commit
3c1cbaa769
@ -63,8 +63,6 @@ public class SurePetcareAPIHelper {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(SurePetcareAPIHelper.class);
|
||||
|
||||
private static final String API_USER_AGENT = "Mozilla/5.0 (Linux; Android 7.0; SM-G930F Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/64.0.3282.137 Mobile Safari/537.36";
|
||||
|
||||
private static final String API_URL = "https://app.api.surehub.io/api";
|
||||
private static final String TOPOLOGY_URL = API_URL + "/me/start";
|
||||
private static final String PET_BASE_URL = API_URL + "/pet";
|
||||
@ -78,9 +76,15 @@ public class SurePetcareAPIHelper {
|
||||
private String username = "";
|
||||
private String password = "";
|
||||
|
||||
private final String userAgent;
|
||||
|
||||
private @NonNullByDefault({}) HttpClient httpClient;
|
||||
private SurePetcareTopology topologyCache = new SurePetcareTopology();
|
||||
|
||||
public SurePetcareAPIHelper() {
|
||||
userAgent = "openHAB/" + org.openhab.core.OpenHAB.getVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the httpClient object to be used for API calls to Sure Petcare.
|
||||
*
|
||||
@ -369,7 +373,7 @@ public class SurePetcareAPIHelper {
|
||||
request.header(HttpHeader.AUTHORIZATION, "Bearer " + authenticationToken);
|
||||
request.header(HttpHeader.CONNECTION, "keep-alive");
|
||||
request.header(HttpHeader.CONTENT_TYPE, "application/json; utf-8");
|
||||
request.header(HttpHeader.USER_AGENT, API_USER_AGENT);
|
||||
request.header(HttpHeader.USER_AGENT, userAgent);
|
||||
request.header(HttpHeader.REFERER, "https://surepetcare.io/");
|
||||
request.header("Origin", "https://surepetcare.io");
|
||||
request.header("Referer", "https://surepetcare.io");
|
||||
|
Loading…
Reference in New Issue
Block a user