Alibaba Cloud FC Util Library for Python
Project description
README
Installation
- install with
pip
tool.
# install alibabacloud_fc_open20210406
pip install -U alibabacloud_fc_open20210406
Usage
- Invoke HTTP Trigger
# -*- coding: utf-8 -*-
import os
from alibabacloud_fc_open20210406.client import Client
from alibabacloud_tea_openapi import models as open_api_models
ak = os.getenv('ak')
sk = os.getenv('sk')
client = Client(config=open_api_models.Config(access_key_id=ak,
access_key_secret=sk,
region_id='cn-hangzhou'))
resp = client.invoke_httptrigger(url="https://xxx.fcapp.run/action?key=value",
method="GET",
body="anything".encode(encoding='utf-8'),
headers={"k1": "v1", "k2": "v2"})
- Invoke Anonymous HTTP Trigger
import os
from alibabacloud_fc_open20210406.client import Client
from alibabacloud_tea_openapi import models as open_api_models
ak = os.getenv('ak')
sk = os.getenv('sk')
client = Client(config=open_api_models.Config(access_key_id=ak,
access_key_secret=sk,
region_id='cn-hangzhou'))
resp = client.invoke_anonymous_httptrigger(url="https://xxx.fcapp.run/action?key=value",
method="GET",
body="anything".encode(encoding='utf-8'),
headers={"k1": "v1", "k2": "v2"})
- Integration with your own http_client
import requests
import os
from alibabacloud_fc_open20210406.client import Client
from alibabacloud_tea_openapi import models as open_api_models
ak = os.getenv('ak')
sk = os.getenv('sk')
client = Client(config=open_api_models.Config(access_key_id=ak,
access_key_secret=sk,
region_id='cn-hangzhou'))
# build your own request
req = requests.Request(
url='https://xxx.fcapp.run/action?key=value',
method='GET'
)
req = client.sign_request(req)
with requests.Session() as s:
prep=s.prepare_request(req)
resp = s.send(prep)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for alibabacloud_gateway_fc_util-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32f168ab17b392024853105c77a5d342681137bf4e6f68092783f358720753b0 |
|
MD5 | 3347cfb0269b90334520644cc78f02c2 |
|
BLAKE2b-256 | 88331fcbcc441185f2d9e995bf7ce404698a8f276ed5c00975fc27d73d738a2f |