python - 如何验证 OAUTH2 以在 Python 中使用 API?
问题描述
我正在尝试连接 FHIR 服务器以使用 API 并提取信息。
到目前为止,我可以连接,但它需要我使用浏览器进行身份验证并输入我的用户和密码。我正在寻找一种自动化的方法,这样我就可以在不登录浏览器的情况下进行身份验证。
目前我正在使用https://github.com/smart-on-fhir/client-py来执行此操作,但我对其他解决方案持开放态度。我当前执行此操作的代码如下:
from fhirclient import client
def connect_to_fhir():
settings = {
'app_id': 'MyApp',
'api_base': 'https://endpointurl.com/api/',
'redirect_uri': 'https://localhost:8000/fhir-app/',
'patient_id': 'test',
}
smart = client.FHIRClient(settings=settings)
print(smart.authorize_url)
smart.handle_callback(input('Authorize and paste callback url here: '))
return smart
解决方案
推荐阅读
- active-directory - 仅针对已启用\活动成员的后缀 ldap 查询
- gnuradio - gnuradio:有没有办法在运行时更改 GUI 选择器标签/值?
- perl - 从 Perl 的配置文件中提取用户名和密码
- python - 类型错误:close() 缺少 1 个必需的位置参数:'self'
- neo4j - 在图形数据库中,您可以拥有多少个节点标签是否有限制?
- json - 如何读取嵌套的 json?
- google-bigquery - BigQuery 中的更新和内部联接语句问题
- laravel - 找不到类 'Yajra\DataTables\Services\DataTable'
- java - 这个符号在 IntelliJ 中是什么意思?Java 类名上的照明符号
- java - Observer / Observable to PropertyChangeListener