Nov-20-2018, 09:01 PM
Hello,
I'm trying to run a command by url and I get the following error code: KeyError: "text"
Here is my python function
with web.urlopen ('http://{0}:{1}/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version={2}&token={3}&payload={"text":"Test message.\nDavid fait un test API"}'.format(self.ip,self.port,self.apiversion,self.token)) as url:
KeyError: "text"
Yet when I take the url in a web browser it works:
http://*******:*****/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token="***************"&payload={"text":"Test message.\nDavid fait un test API"}
Can you tell me why python considers that the "text" key is in error and how I can solve this problem.
Thank you
I'm trying to run a command by url and I get the following error code: KeyError: "text"
Here is my python function
with web.urlopen ('http://{0}:{1}/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version={2}&token={3}&payload={"text":"Test message.\nDavid fait un test API"}'.format(self.ip,self.port,self.apiversion,self.token)) as url:Here is the error message I receive:
with web.urlopen ('http://{0}:{1}/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version={2}&token={3}&payload={"text":"Test message.\nDavid fait un test API"}'.format(self.ip,self.port,self.apiversion,self.token)) as url:
KeyError: "text"
Yet when I take the url in a web browser it works:
http://*******:*****/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token="***************"&payload={"text":"Test message.\nDavid fait un test API"}
Can you tell me why python considers that the "text" key is in error and how I can solve this problem.
Thank you