Spotify.py is broken
This commit is contained in:
parent
3e0657724f
commit
2faf0426df
@ -4,7 +4,7 @@ Find an album using the `spotify_actions` API and echo its contents.
|
||||
|
||||
from argparse import ArgumentParser
|
||||
from asyncio import get_event_loop
|
||||
from logging import basicConfig, DEBUG
|
||||
from logging import DEBUG, basicConfig
|
||||
|
||||
from spotify_actions.echo import echo_album
|
||||
from spotify_actions.search import search_album
|
||||
|
@ -2,15 +2,15 @@
|
||||
Utility methods for working with the Spotify API
|
||||
"""
|
||||
from asyncio import AbstractEventLoop
|
||||
from pathlib import Path
|
||||
from typing import Optional, Awaitable, Dict, Any
|
||||
from logging import getLogger
|
||||
from pathlib import Path
|
||||
from typing import Any, Awaitable, Dict, Optional
|
||||
|
||||
import yaml
|
||||
from aiohttp import TraceConfig, ClientSession, TraceRequestEndParams, TraceResponseChunkReceivedParams
|
||||
from aiohttp import (ClientSession, TraceConfig, TraceRequestEndParams,
|
||||
TraceResponseChunkReceivedParams)
|
||||
from spotify import Client, HTTPClient
|
||||
|
||||
|
||||
LOGGER = getLogger(__name__)
|
||||
|
||||
|
||||
@ -49,12 +49,14 @@ class UnescapeClient(Client):
|
||||
_default_http_client = UnescapeHTTPClient
|
||||
|
||||
|
||||
def read_credentials(path: Path, loop: AbstractEventLoop, trace_config: Optional[TraceConfig] = None) -> Client:
|
||||
def read_credentials(
|
||||
path: Path, loop: AbstractEventLoop, trace_config: Optional[TraceConfig] = None
|
||||
) -> Client:
|
||||
"Read credentials from a YAML file and construct a Spotify client"
|
||||
|
||||
if trace_config:
|
||||
class TracingHTTPClient(UnescapeHTTPClient):
|
||||
|
||||
class TracingHTTPClient(UnescapeHTTPClient):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@ -73,4 +75,6 @@ def read_credentials(path: Path, loop: AbstractEventLoop, trace_config: Optional
|
||||
|
||||
with open(path, "r") as credentials_file:
|
||||
credentials = yaml.safe_load(credentials_file)
|
||||
return client_cls(credentials["client_id"], credentials["client_secret"], loop=loop)
|
||||
return client_cls(
|
||||
credentials["client_id"], credentials["client_secret"], loop=loop
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user