Skip to content

Commit 7f8cc95

Browse files
committed
Update ServiceNow.py
1 parent 0235ed7 commit 7f8cc95

File tree

1 file changed

+8
-8
lines changed
  • endevor/ServiceNow-Interface/COBOL+REXX+PythonOrGoLang-Example

1 file changed

+8
-8
lines changed

endevor/ServiceNow-Interface/COBOL+REXX+PythonOrGoLang-Example/ServiceNow.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
from requests.auth import HTTPBasicAuth
99
import json
1010
## Build the complete url here
11-
print("#Arguments:", sys.argvÝ1) # Additional arguments passed
12-
listticketnumber = sys.argvÝ1:2¨
11+
print("#Arguments:", sys.argv1:�) # Additional arguments passed
12+
listticketnumber = sys.argv1:2
1313
print("#listticketnumber :", type(listticketnumber), listticketnumber)
14-
ticketnumber = listticketnumberÝ0¨
14+
ticketnumber = listticketnumber0
1515
ticketnumberType = type(ticketnumber)
16-
mySubstring = ticketnumberÝ0:3¨ # does a substring
16+
mySubstring = ticketnumber0:3 # does a substring
1717
#
18-
url = "https://dev341534.service-now.com/api/now/table"
18+
url = "https://yoursite.service-now.com/api/now/table"
1919
if mySubstring == 'PRB':
2020
print('problem ticket query')
2121
url = url + "/problem?sysparm_query=number="
@@ -26,10 +26,10 @@
2626
url = url + ticketnumber
2727
print("#url:", url) # complete url
2828
#
29-
response = requests.get(url, auth=HTTPBasicAuth('admin', 'j=H%D9U3ukJk'))
29+
response = requests.get(url, auth=HTTPBasicAuth('admin', 'yourpassword'))
3030
print(response.content)
3131
out = json.loads(response.content)
32-
n = outÝ'result'¨
32+
n = out'result'
3333
#
3434
typeout = type(out)
3535
typen = type(n)
@@ -38,7 +38,7 @@
3838
#
3939
if len(n) == 0:
4040
print("error - no output")
41-
elif "number" in nÝ0¨.keys():
41+
elif "number" in n0.keys():
4242
print("Exists")
4343
else:
4444
print("error - not found")

0 commit comments

Comments
 (0)