Skip to content

Commit a1e0f6d

Browse files
authored
Merge pull request #17 from docentYT/development
v1.0.2
2 parents 576a0ba + 851772a commit a1e0f6d

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.0.2]
9+
### Fixed
10+
- Auth problems in API when using characters unsupported by latin-1 codec.
11+
812
## [1.0.1]
913
### Fixed
1014
- `api.notes.create()` created only anonymous notes.

src/osm_easy_api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = "1.0.1"
1+
VERSION = "1.0.2"
22

33
from .data_classes import *
44
from .diff import Diff, Frequency

src/osm_easy_api/api/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self, url: str = "https://master.apis.dev.openstreetmap.org", usern
3737
self.notes = Notes_Container(self)
3838

3939
if username and password:
40-
self._auth = HTTPBasicAuth(username, password)
40+
self._auth = HTTPBasicAuth(username.encode('utf-8'), password.encode('utf-8'))
4141
else:
4242
self._auth = None
4343

tests/api/test_api.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,16 @@
33
from osm_easy_api import Api
44

55
class TestApi(unittest.TestCase):
6-
api = Api("https://test.pl")
6+
def test_initialize(self):
7+
Api("https://test.pl")
8+
9+
def test_credintials(self):
10+
api = Api(username="abc", password="cba")
11+
self.assertIsNotNone(api._auth)
12+
self.assertEqual(api._auth.username.decode(), "abc")
13+
self.assertEqual(api._auth.password.decode(), "cba")
14+
15+
api = Api(username="ęśąćź", password="ąęźż")
16+
self.assertIsNotNone(api._auth)
17+
self.assertEqual(api._auth.username.decode(), "ęśąćź")
18+
self.assertEqual(api._auth.password.decode(), "ąęźż")

0 commit comments

Comments
 (0)