mirror of https://github.com/M66B/FairEmail.git
DeepL: authorize via header
This commit is contained in:
parent
9627e235a9
commit
d7baa92556
|
@ -209,13 +209,14 @@ public class DeepL {
|
|||
}
|
||||
}
|
||||
|
||||
URL url = new URL(getBaseUri(key) + "translate?auth_key=" + key);
|
||||
URL url = new URL(getBaseUri(key) + "translate");
|
||||
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setDoOutput(true);
|
||||
connection.setReadTimeout(DEEPL_TIMEOUT * 1000);
|
||||
connection.setConnectTimeout(DEEPL_TIMEOUT * 1000);
|
||||
ConnectionHelper.setUserAgent(context, connection);
|
||||
connection.setRequestProperty("Authorization", "DeepL-Auth-Key " + key);
|
||||
connection.setRequestProperty("Accept", "*/*");
|
||||
connection.setRequestProperty("Content-Length", Integer.toString(request.length()));
|
||||
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
@ -272,11 +273,12 @@ public class DeepL {
|
|||
String key = prefs.getString("deepl_key", null);
|
||||
|
||||
// https://www.deepl.com/docs-api/other-functions/monitoring-usage/
|
||||
URL url = new URL(getBaseUri(key) + "usage?auth_key=" + key);
|
||||
URL url = new URL(getBaseUri(key) + "usage");
|
||||
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
||||
connection.setReadTimeout(DEEPL_TIMEOUT * 1000);
|
||||
connection.setConnectTimeout(DEEPL_TIMEOUT * 1000);
|
||||
ConnectionHelper.setUserAgent(context, connection);
|
||||
connection.setRequestProperty("Authorization", "DeepL-Auth-Key " + key);
|
||||
connection.connect();
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue