4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

HinemosのSOAP APIをpythonでつつくサンプル

Posted at

お金を出せばHinemosコマンドラインツールが使えるけれど、貧乏だからそんな金がない。
そんなあなたのためにPythonでHinemos SOAP APIをつつくサンプルコードを晒す。

サンプルコード

まぁ、特に説明しなくてもコード見りゃわかるっしょ。
pathlib、requests、zeepはpipってください。

#!/usr/bin/python
# -*- coding:utf-8 -*-

import pathlib
from zeep import Client
from zeep.transports import Transport
from requests.auth import HTTPBasicAuth
from requests import Session

# 認証情報
username = "hinemos";
password = "hinemos";

# WSDLはこの辺から取得 http://hinemos_manager:8080/HinemosWS/RepositoryEndpoint?wsdl
# 使えるSOAPメソッドの確認はCLIで下記のように行う。
# python -mzeep wsdl.xml 
WSDL_path = pathlib.Path.cwd().joinpath('wsdl.xml')

# SOAPクライアント作成
session = Session()
session.auth = HTTPBasicAuth(username, password)
client = Client(str(WSDL_path), transport=Transport(session=session))

# テスト
response = client.service.getNodeListAll()
print(response)

参考リンク

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?