cinek810 / snow-grafana-proxy

Connector for grafana simple-json data source and ServiceNow incidents retieved over ServiceNow API
MIT License
23 stars 5 forks source link

TypeError: string indices must be integers #3

Closed srnlfk closed 6 years ago

srnlfk commented 6 years ago

./snow-grafana-proxy.py 127.0.0.1 - - [25/May/2018 12:58:09] "POST /query HTTP/1.1" 200 - /usr/lib/python2.7/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning)

Exception happened during processing of request from ('127.0.0.1', 55578) Traceback (most recent call last): File "/usr/lib64/python2.7/SocketServer.py", line 295, in _handle_request_noblock self.process_request(request, client_address) File "/usr/lib64/python2.7/SocketServer.py", line 321, in process_request self.finish_request(request, client_address) File "/usr/lib64/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "./snow-grafana-proxy.py", line 21, in init super(SnowRequestsHandler, self).init(*args,**kwargs) File "/usr/lib64/python2.7/SocketServer.py", line 649, in init self.handle() File "/usr/lib64/python2.7/BaseHTTPServer.py", line 340, in handle self.handle_one_request() File "/usr/lib64/python2.7/BaseHTTPServer.py", line 328, in handle_one_request method() File "./snow-grafana-proxy.py", line 104, in do_POST self.knownUsers[incident["assigned_to"]["value"]]=self._get_person_by_link(incident["assigned_to"]["link"])["last_name"] TypeError: string indices must be integers

snow-grafana-proxy.log:

"assigned_to": "", "assignment_group": { "link": "https://test.service-now.com/api/now/table/sys_user_group/d627dceec0a8016710a232a0f7904d06", "value": "d627dceec0a8016710a232a0f7904d06" },

or

"assigned_to": { "link": "https://test.service-now.com/api/now/table/sys_user/eb53354d371e67109d6b13b853890e78", "value": "eb53354d371e67109d6b13b853890e78" }, "assignment_group": { "link": "https://test.service-now.com/api/now/table/sys_user_group/d627dceec0a8016710a232a0f7904d06", "value": "d627dceec0a8016710a232a0f7904d06" },

cinek810 commented 6 years ago

can you share anonymized version of the xml returned by the links in "assigned_to" ?

srnlfk commented 6 years ago

assigned_to-xml.txt

cinek810 commented 6 years ago

Sorry for the delay. Could you please try with debug mode enabled and current state of the code?

cinek810 commented 6 years ago

@srnlfk were you able to try with the recent version?

cinek810 commented 6 years ago

@srnlfk I'm closing this. Please reopen if you encounter any issues.