mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-27 19:35:10 +01:00
DeepL: authorize via header
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user