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
    • Start testing with double trial credits
    • 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 Cloud Functions
  • Comparison with other Yandex Cloud services
    • Overview
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ
  1. Developing in Python
  2. Using the SDK

Using the SDK for a Python function

Written by
Yandex Cloud
Updated at August 22, 2024

The python37 and python38 runtime environments contain a pre-installed library for working with the Yandex Cloud API. To use it, you do not need to add a dependency to your Python application unless you need a library version different from the pre-installed one.

In python39 or more recent runtime environments, the library is not pre-installed. The user can install it manually by specifying a dependency in requirements.txt.

The library source code is available on GitHub.

The SDK (Software Development Kit) helps you manage Yandex Cloud resources on behalf of the service account specified in the function parameters. For example, you can retrieve a list of available clouds:

import yandexcloud

from yandex.cloud.resourcemanager.v1.cloud_service_pb2 import ListCloudsRequest
from yandex.cloud.resourcemanager.v1.cloud_service_pb2_grpc import CloudServiceStub


def handler(event, context):
    cloud_service = yandexcloud.SDK().client(CloudServiceStub)
    clouds = {}
    for c in cloud_service.List(ListCloudsRequest()).clouds:
        clouds[c.id] = c.name
    return clouds

Was the article helpful?

Previous
Handling errors
Next
Overview
© 2025 Direct Cursus Technology L.L.C.