mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-30 13:10:56 +00:00
save current work
This commit is contained in:
parent
164f3ba00a
commit
704d34d1d9
3 changed files with 15 additions and 14 deletions
13
etl/main.py
13
etl/main.py
|
|
@ -3,7 +3,6 @@ from pdfReader.pdfReaderToText import pdfReaderToText
|
|||
from etl.scraper.scraper import SharePointScraper, SharePointInstaller
|
||||
from pprint import pprint, pformat
|
||||
import logging
|
||||
import tempfile
|
||||
from etl.utils.logger import Logger
|
||||
|
||||
from etl.validator.validator import DomnaSharePointValidator
|
||||
|
|
@ -37,18 +36,6 @@ def main():
|
|||
# logger.info(south_coast_scraper.surveyor_to_housing_assosications)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def create_temp_file(dict_content):
|
||||
with tempfile.NamedTemporaryFile(mode='w+', delete=False, suffix='.txt') as temp_file:
|
||||
formatted_content = pformat(dict_content)
|
||||
temp_file.write(formatted_content + "\n")
|
||||
temp_file_path = temp_file.name
|
||||
|
||||
logger.info(f"Temporary file created at: {temp_file_path}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
|
|
|||
|
|
@ -212,5 +212,6 @@ class SharePointScraper():
|
|||
|
||||
filtered_files = [f for f in file_names_to_download if not f.endswith(tuple(avoid))]
|
||||
self.logger.warning(filtered_files)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import time
|
|||
import logging
|
||||
from io import BytesIO
|
||||
from etl.utils.logger import Logger
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
|
||||
logger = Logger(name="SharePoint.py", level=logging.DEBUG).get_logger()
|
||||
|
|
@ -267,4 +269,15 @@ class SharePointClient:
|
|||
|
||||
file_content.seek(0) # Reset the file pointer to the beginning
|
||||
|
||||
return file_content
|
||||
return file_content
|
||||
|
||||
def create_temp_file(self, content, path):
|
||||
# Ensure the directory exists
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
|
||||
# Write content to the specified temporary file
|
||||
with open(path, 'w+') as temp_file:
|
||||
temp_file.write(content + "\n")
|
||||
|
||||
logger.info(f"Temporary file created at: {path}")
|
||||
return path
|
||||
Loading…
Add table
Reference in a new issue