raul-martin-dev / driveup Goto Github PK
View Code? Open in Web Editor NEWPython package for uploading files and folders to Google Drive
License: MIT License
Python package for uploading files and folders to Google Drive
License: MIT License
from Driveup.drive import Drive
from Driveup.features.auth import authorize
# Global variables
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
SERVICE_SECRET_PATH = os.path.join(tests_dir,"__testsDataFiles","auth_testFiles","service_account_key.json")
UPLOAD_FILE_PATH_1 = os.path.join(tests_dir,"__testsDataFiles","drive_testFiles","test_file.csv")
UPLOAD_FILE_PATH_2 = os.path.join(tests_dir,"__testsDataFiles","drive_testFiles","test_file_test.csv")
DRIVE_FOLDER_ID_1 = 'https://drive.google.com/drive/folders/1wXpG03SN0RXI7y1QAd03IDGH2eXFD_VS'
DRIVE_FOLDER_ID_2 = 'https://drive.google.com/drive/folders/1w32Xx3SNCOF47y1QAs13IDFR8eXFD_VS'
# Method for uploading multiple files simultaneously
def test_multiple_upload(self):
authorization = authorize(CLIENT_SECRET_PATH)
drive = Drive(creds)
files_paths = [UPLOAD_FILE_PATH_1, UPLOAD_FILE_PATH_2]
folder_paths = [DRIVE_FOLDER_ID_1, DRIVE_FOLDER_ID_2]
drive.upload(files_path, folder_paths)
After testing the basic method of uploading a file to a specific directory on Google Drive, I have noticed that I can only upload files that are within a folder/directory. This forces me to upload the entire folder with all the files, and then move them out of the automatically created folder on Drive.
As an improvement and potential use for process automation, it would be beneficial to be able to upload multiple files simultaneously without having to place them within a folder. This would allow for better maneuverability with documents. As a proposed improvement to this method, it would be great to have the option to define different paths or IDs for each file.
An example of implementation or use case could be uploading three different files, such as a Google Doc, a Google Sheet, and a Google Presentation, and sending each to a different directory for storage based on file type.
Driveup current version (v0.2.4) is using the outdated package "pydrive" to make all the flow of authorization, creating and updating files. An update is planned solving this. Current version is functional but have problems in certains tested automations: The current update method updates drive files by overwriting the whole file bringing new changes. This works just fine in almost every ocasion but have problems when linking a google spreadsheets to a LookerStudio inform. There is an instant where Looker doesn't have any data resources and is necessary a manual re-connection of the sheets used (wich is a big problem for automation).
Please apologize for this inconvenience! working hard on this.
Please issue any other possible problems using Driveup or if you find any other automation or circumstance where this problem is replicated.
Thanks for reading.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.