# Path: dbcollection/core/exceptions.py
# class GoogleDriveFileIdDoesNotExist(Exception):
#     """Google drive's file id does not exist."""
#     pass
# 
# class InvalidURLDownloadSource(Exception):
#     """The url source is invalid/undefined."""
#     pass
# 
# class MD5HashNotEqual(Exception):
#     """The MD5 hashes are not equal."""
#     pass
# 
# class URLDoesNotExist(Exception):
#     """URL path does not exist."""
#     pass


import os
import hashlib
import shutil
import tempfile
import requests
import patoolib
import progressbar
from dbcollection.core.exceptions import (
    GoogleDriveFileIdDoesNotExist,
    InvalidURLDownloadSource,
    MD5HashNotEqual,
    URLDoesNotExist,
)
        session = requests.Session()
        token = self.get_confirmation_token(session, file_id)
        response = session.get(self.base_url, params={'id': file_id, 'confirm': token}, stream=True)
        self.save_response_content(response, filename)

    def get_confirmation_token(self, session, file_id):
        """Returns a confirmation token.

        Parameters
        ----------
        session : requests.sessions.Session
            Request session.
        file_id : str
            File ID in the google drive.

        Returns
        ------
        str
            Token string.

        Raises
        ------
        GoogleDriveFileIdDoesNotExist
            If the google drive's file id is invalid.

        """
        response = session.get(self.base_url, params={'id': file_id}, stream=True)
        for key, value in response.cookies.items():
            if key.startswith('download_warning'):
                return value

# Path: dbcollection/core/exceptions.py
# class GoogleDriveFileIdDoesNotExist(Exception):
#     """Google drive's file id does not exist."""
#     pass
# 
# class InvalidURLDownloadSource(Exception):
#     """The url source is invalid/undefined."""
#     pass
# 
# class MD5HashNotEqual(Exception):
#     """The MD5 hashes are not equal."""
#     pass
# 
# class URLDoesNotExist(Exception):
#     """URL path does not exist."""
#     pass


# Path: dbcollection/utils/url.py
import os
import hashlib
import shutil
import tempfile
import requests
import patoolib
import progressbar
from dbcollection.core.exceptions import (
    GoogleDriveFileIdDoesNotExist,
    InvalidURLDownloadSource,
    MD5HashNotEqual,
    URLDoesNotExist,
)

        session = requests.Session()
        token = self.get_confirmation_token(session, file_id)
        response = session.get(self.base_url, params={'id': file_id, 'confirm': token}, stream=True)
        self.save_response_content(response, filename)

    def get_confirmation_token(self, session, file_id):
        """Returns a confirmation token.

        Parameters
        ----------
        session : requests.sessions.Session
            Request session.
        file_id : str
            File ID in the google drive.

        Returns
        ------
        str
            Token string.

        Raises
        ------
        GoogleDriveFileIdDoesNotExist
            If the google drive's file id is invalid.

        """
        response = session.get(self.base_url, params={'id': file_id}, stream=True)
        for key, value in response.cookies.items():
            if key.startswith('download_warning'):
                return value

        raise GoogleDriveFileIdDoesNotExist('Invalid google drive file id: {}.'.format(file_id))