Python 将值 "AddmissionGuid" 转换为 System.GUID 时出错

Python Error converting value "AddmissionGuid" to System.GUID

我正在从请求中接收数据,如下所示

[
  {
    "Info": {
      "SoftwareVersion": "111",
      "IpAddress": "111.111.11",
      "DeviceName": "1111222",
      "Type": "Tablet"
    },
    "DeviceIdentity": "Identity",
    "AdmissionGuid": "db128362-f942-47fb-b18e-c073aa03b95d",
    "UserId": "8c7be5ac-9f2e-42aa-8f17-4e935a85eff3",
    "ConnectionId": "f78f544e-0780-4b07-87ec-d4edbe4cb522",
    "PairingId": null
  }
]

然后我试图在 python 中解析它一切正常我得到了预期的值但是我收到以下错误,我试图将它转换为对象、字符串、十六进制但没有任何效果

Error converting value "AdmissionGuid" to System.GUID

Python 脚本

from requests import Session
from signalr import Connection
import threading, time, json, logging
import urllib.request
import requests
import uuid


GetPatientID = requests.get('http://example-url.com/api/json')



 data = GetAdmissionID.json()
print (type(data))

AdmissionGuid= uuid.UUID(data[0]["AdmissionGuid"])
print (type(AdmissionGuid))

UserID = "8c7be5ac-9f2e-42aa-8f17-4e935a85eff3"
softwareVersion = "111"
IpAddress = "111.111.11"
machineName = "1111222"
DeviceType = "Tablet"
pairingId = "null"
def __init__(self, cli):
    self.cli = cli
    logging.info("registered the cli (main thread)")




with Session() as session:
    connection = Connection("http://example-url.com/signalr", session)
    print(connection)
    logging.info("got the connection")
    presenceservice = connection.register_hub('ClientRegistration')
    logging.info("got the hub")

    connection.start()
    def get_data(notificaition):
        print("Recived something?: ", notificaition)
    def print_error(error):
        print('error: ', error)
    connection.error += print_error
    presenceservice.server.invoke('IdentifyClient', 'devideIdentity', 'softwareVersion', 'ipAddress',
                                          'machineName', 'deviceType', 'patientAdmissionGuid', 'patientId', 'pairingId')
    key = input("Press E\n")
    if key == 'e':
        connection.wait(1)

        presenceservice.client.on('Notification', get_data)

        print ('Nothing Happned')



    connection.wait(30)

和日志

<class 'list'>
<class 'uuid.UUID'>
Press E
e
error:  Error converting value "AdmissionGuid" to type 'System.Guid'.

注意:我也在使用 Singal R 库来调用 C# Hub 来注册客户端。

AdmissionGuid 是使用 GUID 库在 C# 中生成的,

有没有办法进入python?

我已经看过这个1, 2,但这并不能解决我的问题

编辑 我正在用信号 R

调用的 C# 函数
IdentifyClient(string devideIdentity, string softwareVersion, string ipAddress, string machineName, string deviceType, Guid AdmissionGuid, Guid UserID, string pairingId)

我已经解决了我的问题,我正在使用字符串而不是变量调用 IdentifyClient() 函数,这是一个简单的修复。

改变了这个

presenceservice.server.invoke('IdentifyClient', 'devideIdentity', 'softwareVersion', 'ipAddress',
                                          'machineName', 'deviceType', 'patientAdmissionGuid', 'patientId', 'pairingId')

对此

presenceservice.server.invoke('IdentifyClient', devideIdentity, softwareVersion, ipAddress,
                                          machineName, deviceType, patientAdmissionGuid, patientId, pairingId)