Package: globalnoc-wsc
GlobalNOC WSCWSC is a client implementation of the GlobalNOC Web Service calling convention.You can use this library to interface with GlobalNOC Web Services.FeaturesAuthenticationHTTP BasicShibboleth password-based ECPGlobalNOC style service discoveryPOST only. GET is not supported.Getting StartedInstall library...ProfitAPI Examplefromglobalnocimportwscclient=wsc.WSC()client.username='exampleuser'client.password='examplepassword'client.url='https://example.grnoc.iu.edu/something/test.cgi'resp=client.add_the_thing(something="a string of text here",somethingelse=[1,2,3])print'Added as{0}'.format(resp['id'])AuthenticationHTTP Basic AuthenticationHTTP Basic Authentication is supported by setting a username and password. This authentication mode is selected by NOT setting therealm. Credentials are sent on every request, without the401andWWW-Authenticatehandshake.Shibboleth ECPShibboleth ECP is supported by setting a username and password, and setting therealmparameter to your IdP's ECP endpoint URL, e.g.https://idp.grnoc.iu.edu/idp/profile/SAML2/SOAP/ECP. If the SP asks for ECP authentication, a login request is launched to your IdP and, if successful, is sent to the SP. The original request is then re-sent with your login session cookie. Re-authentication is handled transparently (with additional latency if the login is required due to bouncing through the IdP).Only username/password-based authentication is supported.Reserved method namesAny method not defined by the library is assumed to be a WS method. The following names are currently reserved by the library:Any name starting with a_is reserved for internal methods, or by Python.nsgets/sets the path to the GlobalNOC Service Discovery catalog file.urlgets/sets the request URL.urngets/sets the request URN.nsmust be set before this is set. The lookup happens when this is set.usernamegets/sets the authentication username.passwordgets/sets the authentication password.realmgets/sets the authentication realm for ECP. Set toNoneto change from ECP to Basic.rawgets/sets whether the raw response is returned from remote method calls. IfFalse, responses other content-type not matching*/json, or invalid JSON will raise aRemoteMethodException.strict_content_typeget/sets whether non-rawmode requires*/jsoncontent type. DefaultTruesessiongets/sets the underlyingrequests.Sessionobject. Useful for making incompatible requests while benefiting from this library's ECP login help. If doing that, login still only happens during built-in WS calls, not calls directly on theSessionobject.timeoutgets/sets the per-request timeout (in seconds)._saveand_loadsave and load the current cookies in aLWPcookie jar file. This also saves/loads session cookies (as most login cookies are session cookies) so requests from multiple invocations can benefit from one login session. There is no locking around these files.Using ECP login without WSCTheglobalnoc.wsc.ECPmodule implements therequestscustom authentication API. You can use that to perform ECP login without using the WSC calling convention. See therequestsmodule documentation for how to use this.Note: You'll want to use arequests.Sessionor you will log in oneveryrequest, not just once per end host per login lifetime. Logging in on every request increases request time, and increases load on the IdP.importrequestsimportglobalnoc.wscusername='...'password='...'realm='https://...'url='https://...'s=requests.Session()c=s.get(url,auth=globalnoc.wsc.ECP(username,password,realm))