used black
This commit is contained in:
@@ -8,27 +8,33 @@ class SoundCloudEngine:
|
||||
|
||||
async def call(self, request_point: str, params: dict = None):
|
||||
return await self.get(
|
||||
url=f'https://api-v2.soundcloud.com/{request_point}',
|
||||
params=params
|
||||
url=f"https://api-v2.soundcloud.com/{request_point}", params=params
|
||||
)
|
||||
|
||||
async def get(self, url: str, params: dict = None):
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(
|
||||
url,
|
||||
params=(params or {}) | {
|
||||
'client_id': self.client_id,
|
||||
},
|
||||
url,
|
||||
params=(params or {})
|
||||
| {
|
||||
"client_id": self.client_id,
|
||||
},
|
||||
) as r:
|
||||
return await r.json()
|
||||
|
||||
async def read_data(self, url: str, params: dict = None,
|
||||
append_client_id: bool = True):
|
||||
async def read_data(
|
||||
self, url: str, params: dict = None, append_client_id: bool = True
|
||||
):
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(
|
||||
url,
|
||||
params=(params or {}) | ({
|
||||
'client_id': self.client_id,
|
||||
} if append_client_id else {}),
|
||||
url,
|
||||
params=(params or {})
|
||||
| (
|
||||
{
|
||||
"client_id": self.client_id,
|
||||
}
|
||||
if append_client_id
|
||||
else {}
|
||||
),
|
||||
) as r:
|
||||
return await r.content.read()
|
||||
|
||||
Reference in New Issue
Block a user