Package: nhl-api-client
nhl-api-clientA client library for accessing NHL APIUsageFirst, create a client:fromnhl_api_clientimportClientclient=Client(base_url="http://api-web.nhle.com")Now call your endpoint and use your models:fromnhl_api_client.api.defaultimportget_season_standings_by_datefromnhl_api_client.modelsimportSeasonStandingsfromnhl_api_client.typesimportResponsewithclientasclient:teams_response:SeasonStandings=get_season_standings_by_date.sync('2023-11-15',client=client)# or if you need more info (e.g. status_code)response:Response[SeasonStandings]=get_season_standings_by_date.sync_detailed('2023-11-15',client=client)Or do the same thing with an async version:fromnhl_api_client.modelsimportSeasonStandingsfromnhl_api_client.api.my_tagimportget_season_standings_by_datefromnhl_api_client.typesimportResponseasyncwithclientasclient:my_data:SeasonStandings=awaitget_season_standings_by_date.asyncio('2023-11-15',client=client)response:Response[SeasonStandings]=awaitget_season_standings_by_date.asyncio_detailed('2023-11-15',client=client)Things to know:Every path/method combo becomes a Python module with four functions:sync: Blocking request that returns parsed data (if successful) orNonesync_detailed: Blocking request that always returns aRequest, optionally withparsedset if the request was successful.asyncio: Likesyncbut async instead of blockingasyncio_detailed: Likesync_detailedbut async instead of blockingAll path/query params, and bodies become method arguments.If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)Any endpoint which did not have a tag will be innhl_api_client.api.defaultAdvanced customizationsThere are more settings on the generatedClientclass which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlyinghttpx.Clientorhttpx.AsyncClient(depending on your use-case):fromnhl_api_clientimportClientdeflog_request(request):print(f"Request event hook:{request.method}{request.url}- Waiting for response")deflog_response(response):request=response.requestprint(f"Response event hook:{request.method}{request.url}- Status{response.status_code}")client=Client(base_url="http://api-web.nhle.com",httpx_args={"event_hooks":{"request":[log_request],"response":[log_response]}},)# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):importhttpxfromnhl_api_clientimportClientclient=Client(base_url="http://api-web.nhle.com",)# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.client.set_httpx_client(httpx.Client(base_url="http://api-web.nhle.com",proxies="http://localhost:8030"))Building / publishing this packageThis project usesPoetryto manage dependencies  and packaging.  Here are the basics:Update the metadata in pyproject.toml (e.g. authors, version)If you're using a private repository, configure it with Poetrypoetry config repositories.<your-repository-name> <url-to-your-repository>poetry config http-basic.<your-repository-name> <username> <password>Publish the client withpoetry publish --build -r <your-repository-name>or, if for public PyPI, justpoetry publish --buildIf you want to install this client into another project without publishing it (e.g. for development) then:If that projectis using Poetry, you can simply dopoetry add <path-to-this-client>from that projectIf that project is not using Poetry:Build a wheel withpoetry build -f wheelInstall that wheel from the other projectpip install <path-to-wheel>