Code Monkey home page Code Monkey logo

Comments (6)

V-know avatar V-know commented on August 19, 2024

I need this badly as well

from tencentcloud-sdk-python.

V-know avatar V-know commented on August 19, 2024

I need this badly as well

proxy with authentication

from tencentcloud-sdk-python.

devmiek avatar devmiek commented on August 19, 2024

The current community version of the Tencent Cloud SDK for Python has better support for proxy server configuration.

Take the serverless cloud function product as an example:

Import Module

First we need to import the Tencent Cloud SDK for Python related namespaces and modules:

from tencent.cloud.core import proxies
from tencent.cloud.serverless import functions

Product Client

Next we need to instantiate a serverless cloud function product client instance:

client = functions.Client(
    access_proxies = proxies.Proxies(
        proxy_name = 'default',
        proxy_type = proxies.ProxyType.Http,
        proxy_endpoint = '127.0.0.1:1080',
        proxy_auth = {
            'username': 'root',
            'password': 'root'
        }
    )
)

Of course, there is another way:

client = functions.fetch_client()  # This is related to the current hyper-thread.
client.set_access_proxies(...)  # The parameters are consistent with access_proxies.

Call Function

Finally we call a serverless cloud function and get the native return value:

text: str = client.easy_invoke('ap-shanghai', 'default', 'hello')
print('return value: ' + text)

Data Type Proxies also supports managing multiple proxy server configurations, which can be set by accessing the proxies properties of the client instance.

The Tencent Cloud SDK for Python Community Edition is now available through GitHub and PyPI, see the detailed online documentation for more details.

GitHub repository: https://github.com/nobody-night/tencent-cloud-sdk-python
Online documentation: https://smallso.gitbook.io/tencent-cloud-sdk/

from tencentcloud-sdk-python.

Instantnoodles-madman avatar Instantnoodles-madman commented on August 19, 2024

我配置代理时,提示我 missing environment variable <'TENCENTCLOUD_SECRETID'> 请问是什么错误

from tencentcloud-sdk-python.

devmiek avatar devmiek commented on August 19, 2024

我配置代理时,提示我 missing environment variable <'TENCENTCLOUD_SECRETID'> 请问是什么错误

@Instantnoodles-madman Hi, Instantnoodles-madman! 该错误指示当前运行环境缺少环境变量 TENCENTCLOUD_SECRETID,该环境变量用于存储 Tencent Cloud API 访问凭据的 Secret ID 值。我想这可能与您使用 Tencent Cloud SDK for Python 的方式有关,如果没有指定访问凭据,默认 Tencent Cloud SDK for Python 将采用一种被称之为“环境凭据”的访问凭据类型来访问 Tencent Cloud API,也即通过获取运行环境中预设的环境变量作为访问凭据。目前支持的访问凭据类型有:

  • 默认凭据(在源代码中硬编码)
  • 环境凭据
  • 文件凭据

Tencent Cloud SDK for Python 简体中文在线文档的入门篇中会向开发者介绍如何创建并获取适用于您 Tencent Cloud 账户的凭据,然后如何将其用于 Tencent Cloud SDK for Python;最佳实践篇中也会向开发者介绍如何选择并使用适合的访问凭据类型。请您参阅:

相信您通过阅读 Tencent Cloud SDK for Python 在线文档能很快掌握其使用方法。如果您有其他关于 Tencent Cloud SDK for Python 等非该 Issue 主题的问题,请考虑转到 https://github.com/nobody-night/tencent-cloud-sdk-python/issues 跟踪器打开一个新 Issue。

from tencentcloud-sdk-python.

zqfan avatar zqfan commented on August 19, 2024

fixed by db68d5e

from tencentcloud-sdk-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.