Skip to content

Instantly share code, notes, and snippets.

@pyfontan
Last active November 20, 2015 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pyfontan/62b8dab58e09a0982ed8 to your computer and use it in GitHub Desktop.
Save pyfontan/62b8dab58e09a0982ed8 to your computer and use it in GitHub Desktop.
openwsman python bindings use
Nov 20 09:53:31 [28944] Endpoint: http://hostname:443/wsman
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd">
<s:Header/>
<s:Body>
<wsmid:Identify/>
</s:Body>
</s:Envelope>
Nov 20 09:53:31 [28944] cl->authentication.verify_peer: 1
Nov 20 09:53:31 [28944] *****set post buf len = 238******
Nov 20 09:53:31 [28944] Error = 52 (Server returned nothing (no headers, no data)); curl_easy_perform failed
Nov 20 09:53:31 [28944] curl error code: 52.
Nov 20 09:53:31 [28944] cl->response_code: 0.
Nov 20 09:53:31 [28944] cl->last_error code: 1.
Traceback (most recent call last):
File "./wsman_identify.py", line 40, in <module>
main()
File "./wsman_identify.py", line 31, in main
assert doc is not None
AssertionError
import sys
from pywsman import *
def main():
host = "hostname"
port = 443
path = '/wsman'
user = 'XXXX'
password = 'XXXX'
scheme = 'http'
certname = host + ".cer"
certpath = "/datas"
set_debug(1)
client = Client( host, port, path, scheme, user, password )
assert client is not None
transport = client.transport()
assert transport is not None
transport.set_auth_method(BASIC_AUTH_STR)
transport.set_verify_host(False)
transport.set_verify_peer(True)
transport.set_cainfo(certpath + '/' + certname)
options = ClientOptions()
assert options is not None
options.set_dump_request()
doc = client.identify( options )
assert doc is not None
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment