Git Product home page Git Product logo

Comments (1)

zhaoche27 avatar zhaoche27 commented on August 21, 2024

是否指根据这个方法构建request, 然后parse结果获取? 建议你直接使用SDK,请看看 https://github.com/larksuite/oapi-sdk-python/blob/main/src/larksuiteoapi/service/authen/v1/api.py

示例代码# -*- coding: UTF-8 -*-
from larksuiteoapi.service.authen.v1 import Service as AuthenService, model
from larksuiteoapi import DOMAIN_FEISHU, Config, LEVEL_DEBUG, LEVEL_INFO, \
	LEVEL_WARN, LEVEL_ERROR

# 企业自建应用的配置
# AppID、AppSecret: "开发者后台" -> "凭证与基础信息" -> 应用凭证(App ID、App Secret)
# VerificationToken、EncryptKey:"开发者后台" -> "事件订阅" -> 事件订阅(Verification Token、Encrypt Key),非必需,订阅事件、消息卡片时必需
# 更多介绍请看:Github -> README.zh.md -> 如何构建应用配置(AppSettings)
app_settings = Config.new_internal_app_settings(app_id='AppID', app_secret='AppSecret',
                                                verification_token='VerificationToken', encrypt_key='EncryptKey')

# 当前访问的是飞书,使用默认内存存储、默认日志(Error 级别)
# 更多介绍请看:Github -> README.zh.md -> 如何构建整体配置(Config)
conf = Config(DOMAIN_FEISHU, app_settings, log_level=LEVEL_ERROR)

service = AuthenService(conf)

if __name__ == '__main__':
	# body params
	body = model.AuthenAccessTokenReqBody()
	body.grant_type = ''
	body.code = ''
	req_call = service.authens.access_token(body=body)
	
	resp = req_call.do()
	print('request id = %s' % resp.get_request_id())
	print('HTTP status code = %s' % resp.get_http_status_code())
	print('HTTP response header = %s' % resp.get_header().items())
	if resp.code == 0:
		print(resp.data)
	else:
		print(resp.msg)
		print(resp.error)

from oapi-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.