Comments (1)
是否指根据这个方法构建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)
- 这个能接入飞书吗
- service层能不能有个文档啊? HOT 1
- 使用API进行文档 sheet 页面新建或删除,会报错 HOT 1
- 是否可以一些文档,demo...
- Transport cannot deal with utf-8 request body HOT 1
- lark-oapi (v2 main分支)和 larksuite-oapi(main分支)的区别?
- 使用client.im.v1.message_resource.get(request)方法获取文件时,提示AttributeError: 'RawResponse' object has no attribute 'header'
- 执行update请求的时候raise exception
- 如果用django来替代flask应该怎么实现? HOT 2
- 支持Async的请求方式,httpx/aiphttp HOT 2
- RefreshAccessToken got invalid request
- GetAuthorizeRequest 这个方法的返回值是不是调整了 返回的 并不是预期的json格式而是html 导致序列化的时候报错了
- use response.data Got AttributeError: 'InternalAppAccessTokenResponse' object has no attribute 'data' HOT 1
- 怎么获取到飞书文档的授权码
- missing message_id in responsebody
- 感觉封装的不太行,用原生自己封装更好使,就怕接口调整 HOT 1
- [feature request] Add some Enum types
- Feature Request: Have some way to get user_access_token
- im.message.message_read_v1 订阅消息已读事件报错
- How to use `filter`? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oapi-sdk-python.