serviceNow
からレポートのダウンロードを自動化する必要があります。ServiceNow - SOAPを使用してレポートをダウンロードする方法
私はpython
とselenium
とwin32com
を使って以下の方法で自動化することができました。
https://test.service-now.com/sys_report_template.do?CSV&jvar_report_id=92a....7aa
そしてserviceNow
にアクセスするだけでなく、windows
マシン上のフォルダにファイルをダンプするfirefox
デフォルトのダウンロードオプションを変更するselenium
を使用。
ただし、これはすべてlinux
サーバーに移植されるため、SOAP
またはCURL
に移植します。
python
hereのライブラリserviceNow
が見つかりました。使用してサイトに記載されているように私はServiceNow.py
class Change(Base):
__table__ = 'change_request.do'
から次とsiteに記載されているとして、クライアント側のスクリプト内で次のログイン、パスワードおよびインスタンス名を設定した場合
は、私はそれを試してみたし、次のコードは動作しています。私はsys_report_template.do
とURLを交換した場合、エラー
ここ
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\SOAPpy\Parser.py", line 1080, in _parseSOAP
parser.parse(inpsrc)
File "C:\Python27\Lib\xml\sax\expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "C:\Python27\Lib\xml\sax\xmlreader.py", line 125, in parse
self.close()
File "C:\Python27\Lib\xml\sax\expatreader.py", line 220, in close
self.feed("", isFinal = 1)
File "C:\Python27\Lib\xml\sax\expatreader.py", line 214, in feed
self._err_handler.fatalError(exc)
File "C:\Python27\Lib\xml\sax\handler.py", line 38, in fatalError
raise exception
SAXParseException: <unknown>:1:0: no element found
だからreleventコード
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
あるしかし、私は、私の質問は、作るために何を行うことができますされて取得しています
# 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
この作品? ウェブでリソースを探して助けを求めたが、見つからなかった。
何か助けていただければ幸いです。