added python function call add custom information
This commit is contained in:
@@ -97,6 +97,18 @@ def ListNodes():
|
||||
ipTableObject = json.loads((str(ipTable).strip("b'")))
|
||||
dat: IPAddress = dacite.from_dict(IPAddress,ipTableObject)
|
||||
return dat
|
||||
|
||||
# python function to pass-through custom
|
||||
# information to interpret which can be
|
||||
# interpreted as a DSL.
|
||||
def AddCustomInformation(message="") -> bool:
|
||||
message = go_string(c_char_p(message.encode('utf-8')), len(message))
|
||||
|
||||
p2prc.CustomInformation.restype = c_char_p
|
||||
status = p2prc.CustomInformation(message)
|
||||
if str(status).strip("b'") == "Success":
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,3 +5,7 @@ if __name__ == "__main__":
|
||||
P2PRCNodes = ListNodes()
|
||||
# Print nodes in the network
|
||||
print(P2PRCNodes)
|
||||
|
||||
# Add custom information to the network
|
||||
if AddCustomInformation("Test"):
|
||||
print("It worked")
|
||||
|
||||
Reference in New Issue
Block a user