Example #1
0
def create_disk_url(method_name: str) -> str:
    """
    Creates Yandex.Disk URL for request.

    :param method_name: Name of API method in URL.
    """
    return create_url("https://cloud-api.yandex.net/v1/disk", method_name)
Example #2
0
def create_bot_oauth_url(method_name: str) -> str:
    """
    Creates Yandex OAuth URL for bot request.

    :param method_name: Name of API method in URL.
    """
    return create_url("https://oauth.yandex.ru", method_name)
def create_bot_url(method_name: str) -> str:
    """
    Creates Telegram Bot API URL for request.

    :param method_name: Name of API method in URL.
    """
    token = environ["TELEGRAM_API_BOT_TOKEN"]

    return create_url("https://api.telegram.org", f"bot{token}", method_name)
def create_file_download_url(file_path: str) -> str:
    """
    Creates Telegram URL for downloading of file.

    - contains secret information (bot token)!

    :param file_path: `file_path` property of `File` object.
    """
    token = environ["TELEGRAM_API_BOT_TOKEN"]

    return create_url("https://api.telegram.org/file", f"bot{token}",
                      file_path)