Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex DataSphere
  • Getting started
    • All guides
      • Connecting to S3 using the boto3 library
      • Connecting to a ClickHouse® database
      • Connecting to a PostgreSQL database
      • Connecting to Yandex Disk
      • Connecting to Google Drive
    • Migrating a workflow to a new version
  • Terraform reference
  • Audit Trails events
  • Access management
  • Pricing policy
  • Public materials
  • Release notes

In this article:

  • Getting started
  • Uploading the contents from a file on Yandex Disk to a DataSphere project file
  • Uploading the contents from a folder on Yandex Disk to a DataSphere project folder
  1. Step-by-step guides
  2. Connecting to data sources
  3. Connecting to Yandex Disk

Connecting to Yandex Disk

Written by
Yandex Cloud
Updated at October 11, 2024
  • Getting started
  • Uploading the contents from a file on Yandex Disk to a DataSphere project file
  • Uploading the contents from a folder on Yandex Disk to a DataSphere project folder

You can connect to the Yandex Disk file storage service from the DataSphere interface. To upload a file or folder to DataSphere, allow accessing it via a link.

Getting startedGetting started

Open the DataSphere project:

  1. Select the relevant project in your community or on the DataSphere homepage in the Recent projects tab.

  2. Click Open project in JupyterLab and wait for the loading to complete.
  3. Open the notebook tab.

Uploading the contents from a file on Yandex Disk to a DataSphere project fileUploading the contents from a file on Yandex Disk to a DataSphere project file

  1. Go to a new cell and copy the command to import the contents from a file on Yandex Disk to it:

    # %pip install requests urllib if needed
    
    import requests
    from urllib.parse import urlencode
    
    base_url = 'https://cloud-api.yandex.net/v1/disk/public/resources/download?'
    public_key = '<link_to_file_on_Yandex_Disk>'
    
    final_url = base_url + urlencode(dict(public_key=public_key))
    response = requests.get(final_url)
    download_url = response.json()['href']
    response = requests.get(download_url)
    
    dist_path = '<path_to_file_in_project>'
    with open(dist_path, 'wb') as f:
        f.write(response.content)
    

    Where:

    • <link_to_file_on_Yandex_Disk>: Link to the Yandex Disk file whose contents you need to import to DataSphere. To get the link, right-click the file and select Share ⟶ Copy link.
    • <path_to_file_in_project>: Path to the DataSphere project file to import data to. To get the path, right-click the file and select Copy path.
  2. Run the cell. To do this, choose Run → Run Selected Cells or press Shift + Enter.

Uploading the contents from a folder on Yandex Disk to a DataSphere project folderUploading the contents from a folder on Yandex Disk to a DataSphere project folder

  1. Go to a new cell and copy the command to import the contents from a folder on Yandex Disk to it:

    # %pip install requests urllib if needed
    
    import requests
    from urllib.parse import urlencode
    from io import BytesIO
    from zipfile import ZipFile
    
    base_url = 'https://cloud-api.yandex.net/v1/disk/public/resources/download?'
    public_key = '<link_to_folder_on_Yandex_Disk>'
    
    final_url = base_url + urlencode(dict(public_key=public_key))
    response = requests.get(final_url)
    download_url = response.json()['href']
    response = requests.get(download_url)
    
    dist_path = '<path_to_folder_in_project>'
    zipfile = ZipFile(BytesIO(response.content))
    zipfile.extractall(path=dist_path)
    

    Where:

    • <link_to_folder_on_Yandex_Disk>: Link to the folder on Yandex Disk whose contents you need to import to DataSphere. To get the link, right-click the folder and select Share ⟶ Copy link.
    • <path_to_folder_in_project>: Path to the DataSphere project folder to import data to. To get the path, right-click the folder and select Copy path.
  2. Run the cell.

Was the article helpful?

Previous
Connecting to a PostgreSQL database
Next
Connecting to Google Drive
© 2025 Direct Cursus Technology L.L.C.