Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove convert_file_to_b64 in SP Server (unused) #1862

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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