Closed docentYT closed 7 months ago
I'll look into it. Maybe #157 is needed (?)
@docentYT what version of osmapi are you using? The error you describe will happen in osmapi < v3.0.0, please make sure to use the latest version and check again.
I am using version 4.0.0. After pasting the authorization code, I get errors about missing username or password.
I can't reproduce this behavior.
The example code sets auth on the custom HTTP session, which is then passed to the OsmApi constructor:
# create a new requests session using the OAuth authorization
auth_code = input("Paste the authorization code here: ")
auth = OAuth2AuthorizationCodeAuth(
oauth2client,
auth_code,
redirect_uri=redirect_uri,
)
oauth_session = requests.Session()
oauth_session.auth = auth
# use the custom session
api = osmapi.OsmApi(
api="https://api06.dev.openstreetmap.org",
session=oauth_session
)
The only place in OsmApi where UsernamePasswordMissingError
is raised is in http.py
if a call requires authentication (auth
) and no authentication is set (self._auth
):
self._auth
is set in the constructor of OsmApiSession
:
And OsmApiSession
is created in the constructor of OsmApi
using the session
parameter:
Am I missing something?
@docentYT okay I found it, it's been too long since I wrote this code. It's actually part of code I wrote after Release 4.0.0, I should probably release 4.1.0 soon to make this available.
Sorry about that!
@docentYT I just release osmapi 4.1.0, which should resolve your issue.
I am trying to run the example code from readme, but I get an error:
osmapi.errors.UsernamePasswordMissingError: Username/Password missing
. I am using the dev server as it is in the example.