Skip to main content

GlobalNOC WSC

WSC is a client implementation of the GlobalNOC Web Service calling convention.

You can use this library to interface with GlobalNOC Web Services.

Features

  • Authentication
    • HTTP Basic
    • Shibboleth password-based ECP
  • GlobalNOC style service discovery
  • POST only. GET is not supported.

Getting Started

  1. Install library
  2. ...
  3. Profit

API Example

from globalnoc import wsc

client = 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'])

Authentication

HTTP Basic Authentication

HTTP Basic Authentication is supported by setting a username and password. This authentication mode is selected by NOT setting the realm. Credentials are sent on every request, without the 401 and WWW-Authenticate handshake.

Shibboleth ECP

Shibboleth ECP is supported by setting a username and password, and setting the realm parameter 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 names

Any 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.
  • ns gets/sets the path to the GlobalNOC Service Discovery catalog file.
  • url gets/sets the request URL.
  • urn gets/sets the request URN. ns must be set before this is set. The lookup happens when this is set.
  • username gets/sets the authentication username.
  • password gets/sets the authentication password.
  • realm gets/sets the authentication realm for ECP. Set to None to change from ECP to Basic.
  • raw gets/sets whether the raw response is returned from remote method calls. If False, responses other content-type not matching */json, or invalid JSON will raise a RemoteMethodException.
  • strict_content_type get/sets whether non-raw mode requires */json content type. Default True
  • session gets/sets the underlying requests.Session object. 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 the Session object.
  • timeout gets/sets the per-request timeout (in seconds).
  • _save and _load save and load the current cookies in a LWP cookie 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 WSC

The globalnoc.wsc.ECP module implements the requests custom authentication API. You can use that to perform ECP login without using the WSC calling convention. See the requests module documentation for how to use this.

Note: You'll want to use a requests.Session or you will log in on every request, not just once per end host per login lifetime. Logging in on every request increases request time, and increases load on the IdP.

import requests
import globalnoc.wsc

username = '...'
password = '...'
realm = 'https://...'
url = 'https://...'

s = requests.Session()
c = s.get(url, auth=globalnoc.wsc.ECP(username, password, realm))

Metadata

Release files for globalnoc-wsc 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for globalnoc-wsc 2.0.0
File Size Uploaded Provenance
globalnoc_wsc-2.0.0.tar.gz 7.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for globalnoc-wsc 2.0.0
File Interpreter ABI Platform
globalnoc_wsc-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.4 kB

Release files / globalnoc_wsc-2.0.0.tar.gz

Download URL globalnoc_wsc-2.0.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d3e6faef067fcf7d79238653b9ddfcc8dc83d2d0e8dd9907a511598836ad2aee
BLAKE2b-256 checksum
How to use checksums
a279881b24dee065735b7f8d54db233f3178adbb032f39b2036b8427dc357628
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Oracle Linux Server","version":"8.10","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / globalnoc_wsc-2.0.0-py3-none-any.whl

Download URL globalnoc_wsc-2.0.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0df494c41010f05d4175e1e4a62320bf1461c64c60d51fe9d26045b3d8b21438
BLAKE2b-256 checksum
How to use checksums
7207e1c88926ec5576afe7b701cd38d88a6fd92530b99d9dbdf2e9932ab900bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Oracle Linux Server","version":"8.10","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for globalnoc-wsc 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page