Skip to content

Commit

Permalink
Remove convert_file_to_b64 in SP Server (unused) (#1862)
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-shelkovnikov authored Nov 2, 2023
1 parent d806758 commit ac6b7bf
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions connectors/sources/sharepoint_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
from functools import partial
from urllib.parse import quote

import aiofiles
import aiohttp
from aiofiles.os import remove
from aiohttp.client_exceptions import ServerDisconnectedError

from connectors.logger import logger
Expand Down Expand Up @@ -161,24 +159,6 @@ async def close_session(self):
await self.session.close() # pyright: ignore
self.session = None

async def convert_file_to_b64(self, source_file_name):
"""This method converts the file content into b64
Args:
source_file_name: Name of source file
Returns:
attachment_content: Attachment content in b64
"""
async with aiofiles.open(file=source_file_name) as target_file:
# base64 on macOS will add a EOL, so we strip() here
attachment_content = (await target_file.read()).strip()
try:
await remove(source_file_name) # pyright: ignore
except Exception as exception:
self._logger.warning(
f"Could not remove file: {source_file_name}. Error: {exception}"
)
return attachment_content

async def _api_call(self, url_name, url="", **url_kwargs):
"""Make an API call to the SharePoint Server
Expand Down

0 comments on commit ac6b7bf

Please sign in to comment.