DavidMStraub / homeconnect

MIT License
31 stars 15 forks source link

feat: support custom api url #10

Closed MarvinWilliam closed 3 years ago

MarvinWilliam commented 3 years ago

home connect in china have a different api host, i think we could allowed user cutom define api host they want.

doc source https://api-docs.home-connect.com/quickstart?#the-home-connect-api

DavidMStraub commented 3 years ago

Sure, why not, we could just have an optional argument in the constructor to set the API host URL explicitly. Do you want to submit a PR?

DavidMStraub commented 3 years ago

LOL somehow thought this was an issue, not a PR. Perfect @MarvinWilliam & thanks! :rocket:

DavidMStraub commented 3 years ago

Perhaps a bit too fast in merging it, 2 pieces of nitpicking for next time :smile:

api_url: str = None should be api_url: Optional[str] = None (None is not a string) self.host = api_url if api_url else URL_API could be written more elegently as self.host = api_url or URL_API

Cheers!

MarvinWilliam commented 3 years ago

thx for PR merge and code recommend(i‘m new to python :stuck_out_tongue_winking_eye:),i have commit a new code clear PR https://github.com/DavidMStraub/homeconnect/pull/11