diff --git a/sentinelsat/sentinel.py b/sentinelsat/sentinel.py index cc2b6df8..efe9d107 100644 --- a/sentinelsat/sentinel.py +++ b/sentinelsat/sentinel.py @@ -407,7 +407,7 @@ def get_product_odata(self, id, full=False): https://github.com/SentinelDataHub/DataHubSystem/blob/master/addon/sentinel-2/src/main/resources/META-INF/sentinel-2.owl https://github.com/SentinelDataHub/DataHubSystem/blob/master/addon/sentinel-3/src/main/resources/META-INF/sentinel-3.owl """ - url = urljoin(self.api_url, "odata/v1/Products('{}')?$format=json".format(id)) + url = urljoin(self.api_url, u"odata/v1/Products('{}')?$format=json".format(id)) if full: url += '&$expand=Attributes' response = self.session.get(url, auth=self.session.auth) @@ -595,7 +595,7 @@ def check_query_length(query): Ratio of the query length to the maximum length """ # The server uses the Java's URLEncoder implementation internally, which we are replicating here - effective_length = len(quote_plus(query, safe="-_.*", encoding='utf8').replace('~', '%7E')) + effective_length = len(quote_plus(query, safe="-_.*").replace('~', '%7E')) return effective_length / 3938 def _query_names(self, names): diff --git a/tests/test_mod.py b/tests/test_mod.py index 66f7c45c..28c6e1ed 100644 --- a/tests/test_mod.py +++ b/tests/test_mod.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import hashlib import textwrap from datetime import date, datetime, timedelta @@ -374,7 +375,7 @@ def test_count(): @pytest.mark.scihub def test_unicode_support(): api = SentinelAPI(**_api_kwargs) - test_str = 'õäü:' + test_str = u'٩(●̮̮̃•̃)۶:' with pytest.raises(SentinelAPIError) as excinfo: api.count(raw=test_str) @@ -382,7 +383,7 @@ def test_unicode_support(): with pytest.raises(SentinelAPIError) as excinfo: api.get_product_odata(test_str) - assert test_str in excinfo.value.msg + assert test_str in excinfo.value.response.json()['error']['message']['value'] @my_vcr.use_cassette