Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_url(self, *args, **kwargs):
# Note: Including this in the class as a convenience so that you can get all you need from a RWSObject rather
# than having to import make_url as an additional import.
return make_url(*args, **kwargs)
# -----------------------------------------------------------------------------------------------------------------------
# Useful subclasses
# -----------------------------------------------------------------------------------------------------------------------
class RWSGetRequest(RWSRequest):
method = "GET"
class RWSAuthorizedGetRequest(RWSGetRequest):
requires_authorization = True
class RWSPostRequest(RWSRequest):
method = "POST"
class RWSAuthorizedPostRequest(RWSPostRequest):
requires_authorization = True
class QueryOptionGetRequest(RWSAuthorizedGetRequest):
"""Manages requests that have known query string options"""
KNOWN_QUERY_OPTIONS = []
def _querystring(self):
class VersionRequest(RWSGetRequest):
"""Get RWS Version number"""
def url_path(self):
return make_url('version')
class BuildVersionRequest(RWSGetRequest):
"""Return the RWS build version number"""
def url_path(self):
return make_url('version', 'build')
class CodeNameRequest(RWSGetRequest):
"""Return the RWS version codename"""
def url_path(self):
return make_url('version', 'codename')
class DiagnosticsRequest(RWSGetRequest):
"""Return the RWS build version number"""
def url_path(self):
return make_url('diagnostics')
class TwoHundredRequest(RWSGetRequest):
"""Return RWS MAuth information"""
class CodeNameRequest(RWSGetRequest):
"""Return the RWS version codename"""
def url_path(self):
return make_url('version', 'codename')
class DiagnosticsRequest(RWSGetRequest):
"""Return the RWS build version number"""
def url_path(self):
return make_url('diagnostics')
class TwoHundredRequest(RWSGetRequest):
"""Return RWS MAuth information"""
def url_path(self):
return make_url('twohundred')
class CacheFlushRequest(RWSAuthorizedGetRequest):
"""Calls RWS cache-flush"""
def url_path(self):
return make_url('webservice.aspx?CacheFlush')
def result(self, request):
"""Return RWSResponse object for success"""
return RWSResponse(request.text)
kw[key] = val
return kw
# ---------------------------------------------------------------------------------------------------------------------
# Implementations. These are all standards that have existed for a long time.
# ---------------------------------------------------------------------------------------------------------------------
class VersionRequest(RWSGetRequest):
"""Get RWS Version number"""
def url_path(self):
return make_url('version')
class BuildVersionRequest(RWSGetRequest):
"""Return the RWS build version number"""
def url_path(self):
return make_url('version', 'build')
class CodeNameRequest(RWSGetRequest):
"""Return the RWS version codename"""
def url_path(self):
return make_url('version', 'codename')
class DiagnosticsRequest(RWSGetRequest):
"""Return the RWS build version number"""
class BuildVersionRequest(RWSGetRequest):
"""Return the RWS build version number"""
def url_path(self):
return make_url('version', 'build')
class CodeNameRequest(RWSGetRequest):
"""Return the RWS version codename"""
def url_path(self):
return make_url('version', 'codename')
class DiagnosticsRequest(RWSGetRequest):
"""Return the RWS build version number"""
def url_path(self):
return make_url('diagnostics')
class TwoHundredRequest(RWSGetRequest):
"""Return RWS MAuth information"""
def url_path(self):
return make_url('twohundred')
class CacheFlushRequest(RWSAuthorizedGetRequest):
"""Calls RWS cache-flush"""
def _querystring(self):
"""Get additional keyword arguments"""
kw = {}
for key in self.KNOWN_QUERY_OPTIONS:
val = getattr(self, key)
if val is not None:
kw[key] = val
return kw
# ---------------------------------------------------------------------------------------------------------------------
# Implementations. These are all standards that have existed for a long time.
# ---------------------------------------------------------------------------------------------------------------------
class VersionRequest(RWSGetRequest):
"""Get RWS Version number"""
def url_path(self):
return make_url('version')
class BuildVersionRequest(RWSGetRequest):
"""Return the RWS build version number"""
def url_path(self):
return make_url('version', 'build')
class CodeNameRequest(RWSGetRequest):
"""Return the RWS version codename"""