Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Change(Base):
- __table__ = 'change_request.do'
- # Fetch changes updated on the last 5 minutes
- changes = chg.last_updated(minutes=5)
- #print changes client side script.
- for eachline in changes:
- print eachline
- Traceback (most recent call last):
- File "C:Python27libsite-packagesSOAPpyParser.py", line 1080, in _parseSOAP
- parser.parse(inpsrc)
- File "C:Python27Libxmlsaxexpatreader.py", line 107, in parse
- xmlreader.IncrementalParser.parse(self, source)
- File "C:Python27Libxmlsaxxmlreader.py", line 125, in parse
- self.close()
- File "C:Python27Libxmlsaxexpatreader.py", line 220, in close
- self.feed("", isFinal = 1)
- File "C:Python27Libxmlsaxexpatreader.py", line 214, in feed
- self._err_handler.fatalError(exc)
- File "C:Python27Libxmlsaxhandler.py", line 38, in fatalError
- raise exception
- SAXParseException: <unknown>:1:0: no element found
- from servicenow import ServiceNow
- from servicenow import Connection
- from servicenow.drivers import SOAP
- # For SOAP connection
- conn = SOAP.Auth(username='abc', password='def', instance='test')
- rpt = ServiceNow.Base(conn)
- rpt.__table__ = "sys_report_template.do?CSV"
- #jvar_report_id replaced with .... to protect confidentiality
- report = rpt.fetch_one({'jvar_report_id': '92a6760a......aas'})
- for eachline in report:
- print eachline
- import requests
- import json
- # Set the request parameters
- url= 'https://myinstance.service-now.com/sys_report_template.do?CSV&jvar_report_id=929xxxxxxxxxxxxxxxxxxxx0c755'
- user = 'my_username'
- pwd = 'my_password'
- # Set proper headers
- headers = {"Accept":"application/json"}
- # Do the HTTP request
- response = requests.get(url, auth=(user, pwd), headers=headers )
- response.raise_for_status()
- print response.text
- f=open(r"C:pythonmyoutputMy_sn_Report.csv", "w")
- print (response.text, file=f)
- f.close()
Add Comment
Please, Sign In to add comment