Implement ad management
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
"""See https://agoradesk.com/api-docs/v1."""
|
||||
# pylint: disable=too-many-lines
|
||||
# Large API. Lots of lines can't be avoided.
|
||||
import json
|
||||
import logging
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
import aiohttp
|
||||
import arrow
|
||||
import orjson
|
||||
|
||||
from core.util import logs
|
||||
|
||||
@@ -71,7 +71,7 @@ class AgoraDesk:
|
||||
logger.debug("Headers : %s", headers)
|
||||
logger.debug("HTTP Method : %s", http_method)
|
||||
logger.debug("Query Values: %s", query_values)
|
||||
logger.debug("Query Values as Json:\n%s", json.dumps(query_values))
|
||||
logger.debug("Query Values as Json:\n%s", orjson.dumps(query_values))
|
||||
|
||||
result: Dict[str, Any] = {
|
||||
"success": False,
|
||||
@@ -83,7 +83,7 @@ class AgoraDesk:
|
||||
response = None
|
||||
if http_method == "POST":
|
||||
if query_values:
|
||||
cast["data"] = query_values
|
||||
cast["data"] = orjson.dumps(query_values)
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.post(api_call_url, **cast) as response_raw:
|
||||
response = await response_raw.json()
|
||||
@@ -98,7 +98,6 @@ class AgoraDesk:
|
||||
response = await response_raw.json()
|
||||
status_code = response_raw.status
|
||||
if response:
|
||||
print("YES RESPONSE", response)
|
||||
logger.debug(response)
|
||||
result["status"] = status_code
|
||||
if status_code == 200:
|
||||
@@ -501,7 +500,7 @@ class AgoraDesk:
|
||||
params["lat"] = lat
|
||||
if lon:
|
||||
params["lon"] = lon
|
||||
if visible:
|
||||
if visible is not None:
|
||||
params["visible"] = True if visible else False
|
||||
|
||||
return await self._api_call(
|
||||
|
||||
Reference in New Issue
Block a user