dev #19
@ -96,7 +96,7 @@ async def random_pic(token: Union[str, None] = None) -> Tuple[str, str]:
|
|||||||
|
|
||||||
async def upload_pic(
|
async def upload_pic(
|
||||||
filepath: str, allow_duplicates: bool = False, token: Union[str, None] = None
|
filepath: str, allow_duplicates: bool = False, token: Union[str, None] = None
|
||||||
) -> Tuple[bool, list]:
|
) -> Tuple[bool, list, str]:
|
||||||
token = await authorize() if token is None else token
|
token = await authorize() if token is None else token
|
||||||
try:
|
try:
|
||||||
pic_name = path.basename(filepath)
|
pic_name = path.basename(filepath)
|
||||||
@ -135,10 +135,10 @@ async def upload_pic(
|
|||||||
duplicates.append(
|
duplicates.append(
|
||||||
f'`{duplicate["id"]}`:\n{configGet("address_external", "posting", "api")}/token/photo/{(await response.json())["access_token"]}?id={index}'
|
f'`{duplicate["id"]}`:\n{configGet("address_external", "posting", "api")}/token/photo/{(await response.json())["access_token"]}?id={index}'
|
||||||
)
|
)
|
||||||
return True, duplicates
|
return True, duplicates, (await response.json())["id"]
|
||||||
except Exception as exp:
|
except Exception as exp:
|
||||||
print_exc()
|
print_exc()
|
||||||
return False, []
|
return False, [], ""
|
||||||
|
|
||||||
|
|
||||||
async def find_pic(
|
async def find_pic(
|
||||||
|
Reference in New Issue
Block a user