1

I am receiving data from a request as follows

[
  {
    "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
  }
]

Then I am trying to parse it in python everything works i get the value as expected but i get the following error, I have tried to convert it to Object, String, Hex but nothing works

Error converting value "AdmissionGuid" to System.GUID

Python script

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)

And the log

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

Note: I am also using Singal R libary to invoke a C# Hub to register a client.

AdmissionGuid is Generated in C# using the GUID library,

Is there a way to get in python ?

I have looked at this already 1, 2, But this does not solve my problem

EDIT C# Function i am Calling with singal R

IdentifyClient(string devideIdentity, string softwareVersion, string ipAddress, string machineName, string deviceType, Guid AdmissionGuid, Guid UserID, string pairingId)
AutoTester213
  • 2,714
  • 2
  • 24
  • 48

1 Answers1

1

I have fixed my issue, I was Invoking the IdentifyClient() function with String rather than variables it was a simple fix.

Changed this

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

To this

presenceservice.server.invoke('IdentifyClient', devideIdentity, softwareVersion, ipAddress,
                                          machineName, deviceType, patientAdmissionGuid, patientId, pairingId)
AutoTester213
  • 2,714
  • 2
  • 24
  • 48