Skip to content

Sepehr0Day/DriveX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DriveX

Connect to Google Drive

  1. Installation:

    Install the DriveX library from PyPI or GitHub.

    pip install DriveX

    or

    git clone https://github.com/Sepehr0Day/DriveX.git
  2. Obtain Google Drive API Credentials:

    • Create a project in the Google Cloud Console.
    • Enable the Google Drive API for your project.
    • Create OAuth client ID credentials.
    • Download the credentials JSON file.
  3. Code:

    from DriveX import ServiceBuilder, GoogleDriveAPI
    
    # Path to the credentials JSON file
    credentials_path = 'credentials.json'
    
    # Path to save token
    token_path = 'Resources/Authenticator'
    
    # Name for the token file
    token_name = 'token'
    
    # Create ServiceBuilder object
    service_builder = ServiceBuilder(credentials_path=credentials_path, token_path=token_path, token_name=token_name)
    
    try:
        # Build service
        drive_service = service_builder.build_service()
        
        # Connect to Google Drive API
        drive_api = GoogleDriveAPI(service=drive_service, credentials=credentials_path)
        
        print("You Successfully Connected To Your Google Drive Account!")     
    
    except Exception as e:
        print(f"An error occurred: {e}")

    Make sure to replace 'credentials.json' with the path to your credentials JSON file obtained from the Google Cloud Console.

Documentation DriveX:

For more information and advanced usage, refer to the DriveX documentation.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Developer


Feel free to contribute to the project or report any issues on the GitHub repository!