mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
added files for modifgication
This commit is contained in:
parent
2331105f96
commit
f55e8f7a64
2 changed files with 24 additions and 1 deletions
21
etl/MonthEndUploader.py
Normal file
21
etl/MonthEndUploader.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import os
|
||||
os.environ["SHAREPOINT_CLIENT_ID"] = "6832a4c5-fb8c-4082-a746-4f51e1020f0d"
|
||||
os.environ["SHAREPOINT_CLIENT_SECRET"] = "xpC8Q~Frww48SM1V-D8lGy5iOY7P_cJ7FF3jgarQ"
|
||||
os.environ["SHAREPOINT_TENANT_ID"] = "10d5af8b-2cfd-4882-9ccd-b96e4812dacf"
|
||||
from etl.scraper.scraper import SharePointScraper, SharePointInstaller
|
||||
import datetime
|
||||
|
||||
|
||||
def upload_to_month_end_folder(file_name_on_sp, local_file_path):
|
||||
sharepoint = SharePointScraper(SharePointInstaller.OSMOSIS_WAVE_2)
|
||||
|
||||
parent_folder = "General/Junte Kim/month end"
|
||||
today = datetime.today()
|
||||
# Format as "Month YYYY"
|
||||
formatted_date = today.strftime("%B %Y")
|
||||
|
||||
sharepoint.create_dir(formatted_date, parent_folder)
|
||||
sharepoint_path = parent_folder + "/" + formatted_date
|
||||
print("Uploading to sharepoint...")
|
||||
sharepoint.upload_file(local_file_path, sharepoint_path, file_name_on_sp)
|
||||
print(f"Finished upload of {local_file_path} to sharepoint. It's found under {sharepoint_path}/{file_name_on_sp}")
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
# Wave 2's month end automation
|
||||
|
||||
# Wave 2's month end automation
|
||||
from tqdm import tqdm
|
||||
from monday import MondayClient
|
||||
from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids
|
||||
from pprint import pprint
|
||||
import pandas as pd
|
||||
import json
|
||||
from MonthEndUploader import upload_to_month_end_folder
|
||||
|
||||
|
||||
monday_key = "eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjQ5ODc2ODQxOCwiYWFpIjoxMSwidWlkIjozNjE3ODAzNCwiaWFkIjoiMjAyNS0wNC0xMVQxMToyMzoxNy40NjdaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6MTM5OTc4MjMsInJnbiI6InVzZTEifQ.-2Lit4s46ZF6AXuMW9t0TxIaFLkHqD4Yo-PyM9i2XZY"
|
||||
monday = MondayClient(monday_key)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue