python - 如何在 fhirclient-4.0.0 python 库中设置自定义 header ?

标签 python hl7-fhir hapi-fhir smart-on-fhir

我正在使用 fhirclient-4.0.0 并使用此库将 Http 请求发送到我的 fhir 服务器。对于更新请求,我需要发送一个额外的 header “If-Match”。但我没有看到任何选项来执行此操作或设置自定义 header 。

这是我的Python代码。

    from fhirclient import client
    import fhirclient.models.encounter as en
    settings = {
        'app_id': 'fhir',
        'api_base': 'http://hapi.fhir.org/baseR4'
    }
    smart = client.FHIRClient(settings=settings) 

    encounter = en.Encounter()
    encounter.id = get_fhir_encounter_id(<parameter>)
    encounter.subject = get_fhir_encounter_subject(<parameter>)
    encounter.location = get_fhir_encounter_location(<parameter>)
    encounter.period = get_fhir_encounter_period(<parameter>)
    encounter.reasonCode = get_fhir_encounter_reasoncode(<parameter>)
    encounter.status = get_fhir_encouter_status(<parameter>)
    encounter.identifier = get_fhir_encounter_identifier(<parameter>)
    encounter.class_fhir = get_fhir_encounter_class(<parameter>)

    #Sending the update request
    en.Encounter.update(encounter, smart.server)

是否有任何配置可用于设置自定义 header ?

最佳答案

我相信此 PR 可以解决您的部分问题 https://github.com/smart-on-fhir/client-py/pull/66可能需要另一个 PR 将 header 一直拉到资源模型

关于python - 如何在 fhirclient-4.0.0 python 库中设置自定义 header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59050661/

相关文章:

hl7-fhir - FHIR 搜索同一参数的多个值

java - Kafka 的流 API 可以帮助分发数百个分页请求吗?

scala - 无法使用Spark Scala从json嵌套属性中删除 “\”

python - 使用python中的argparse模块来解析单个参数

python - 在 WxPython GUI 线程上运行函数

java - 最新代码中的 FHIR _id 至 id 更改

javascript - Epic App Orchard 如何获取从业者 ID 或信息

python - 值错误: could not convert string to float

python - 如何将 axhline 发送到 Matplotlib 条形图的后面

java - FHIR 的 JSON 架构到 Java 类