astagi / pyphoton

🗺 Light Komoot Photon client written in Python
https://photon.komoot.io
MIT License
6 stars 1 forks source link

Hosts with authentication #5

Open do-me opened 1 year ago

do-me commented 1 year ago

Thanks for this client!

I was wondering whether you could add the option for basic auth to access non-public clients. Something like this should probably work

import json
import requests
from requests.auth import HTTPBasicAuth

from .errors import PhotonException
from .models import Location, Point

class Photon:
    def __init(
        self,
        host='https://photon.komoot.io',
        language='en',
        username=None, 
        password=None, 
    ):
        self._host = host.strip('/')
        self._language = language
        self._auth = HTTPBasicAuth(username, password)  
astagi commented 1 year ago

Hi @do-me thanks! Feel free to send a PR if you want :)