本文整理汇总了Python中seiscomp3.Logging.warning方法的典型用法代码示例。如果您正苦于以下问题:Python Logging.warning方法的具体用法?Python Logging.warning怎么用?Python Logging.warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类seiscomp3.Logging
的用法示例。
在下文中一共展示了Logging.warning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: renderErrorPage
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def renderErrorPage(request, code, msg, ro=None):
resp = """\
Error %i: %s
%s
Usage details are available from %s
Request:
%s
Request Submitted:
%s
Service Version:
%s
"""
# rewrite response code if requested and no data was found
if ro is not None and code == http.NO_CONTENT:
code = ro.noData
request.setHeader('Content-Type', 'text/plain')
request.setResponseCode(code)
reference = "%s/" % (request.path.rpartition('/')[0])
codeStr = http.RESPONSES[code]
Logging.warning("responding with error: %i (%s)" % (code, codeStr))
date = Core.Time.GMT().toString("%FT%T.%f")
response = resp % (code, codeStr, msg, reference, request.uri, date,
VERSION)
utils.accessLog(request, ro, code, len(response), msg)
return response
示例2: createCommandLineDescription
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def createCommandLineDescription(self):
try:
self.commandline().addGroup("Parameters")
self.commandline().addStringOption("Parameters", "coord", "lat,lon,dep of origin")
self.commandline().addStringOption("Parameters", "time", "time of origin")
except:
Logging.warning("caught unexpected error %s" % sys.exc_info())
示例3: render_GET
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def render_GET(self, req):
# Parse and validate GET parameters
ro = _EventRequestOptions(req.args)
try:
ro.parse()
except ValueError, e:
Logging.warning(str(e))
return HTTP.renderErrorPage(req, http.BAD_REQUEST, str(e), ro)
示例4: render_POST
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def render_POST(self, req):
# Parse and validate POST parameters
ro = _StationRequestOptions()
try:
ro.parsePOST(req.content)
ro.parse()
except ValueError, e:
Logging.warning(str(e))
return HTTP.renderErrorPage(req, http.BAD_REQUEST, str(e), ro)
示例5: render_GET
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def render_GET(self, req):
# Parse and validate GET parameters
ro = _StationRequestOptions(req.args)
try:
ro.parse()
# the GET operation supports exactly one stream filter
ro.streams.append(ro)
except ValueError, e:
Logging.warning(str(e))
return HTTP.renderErrorPage(req, http.BAD_REQUEST, str(e), ro)
示例6: render_POST
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def render_POST(self, request):
request.setHeader('Content-Type', 'text/plain')
try:
verified = self.__gpg.decrypt(request.content.getvalue())
except Exception, e:
msg = "invalid token"
Logging.warning("%s: %s" % (msg, str(e)))
return HTTP.renderErrorPage(request, http.BAD_REQUEST, msg, None)
示例7: render_POST
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def render_POST(self, req):
# Parse and validate POST parameters
ro = _DataSelectRequestOptions()
ro.userName = self.__user and self.__user.get('mail')
try:
ro.parsePOST(req.content)
ro.parse()
except ValueError, e:
Logging.warning(str(e))
return HTTP.renderErrorPage(req, http.BAD_REQUEST, str(e), ro)
示例8: render_POST
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def render_POST(self, request):
request.setHeader('Content-Type', 'text/plain')
try:
verified = self.__gpg.decrypt(request.content.getvalue())
except OSError, e:
msg = "gpg decrypt error"
Logging.warning("%s: %s" % (msg, str(e)))
return HTTP.renderErrorPage(request, http.INTERNAL_SERVER_ERROR, msg, None)
示例9: render_GET
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def render_GET(self, req):
# Parse and validate POST parameters
ro = _DataSelectRequestOptions(req.args)
ro.userName = self.__user and self.__user.get('mail')
try:
ro.parse()
# the GET operation supports exactly one stream filter
ro.streams.append(ro)
except ValueError, e:
Logging.warning(str(e))
return HTTP.renderErrorPage(req, http.BAD_REQUEST, str(e), ro)
示例10: resumeProducing
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def resumeProducing(self):
rec = None
data = ""
while len(data) < self.bufSize:
try:
rec = self.rsInput.next()
if rec: data += rec.raw().str()
else: break
except Exception, e:
Logging.warning("%s" % str(e))
break
示例11: render_GET
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def render_GET(self, req):
# No archive no service
if not os.path.isdir(self._sdsPath):
msg = "SDS archive not found: %s" % self._sdsPath
return HTTP.renderErrorPage(request, http.SERVICE_UNAVAILABLE, msg)
# Parse and validate GET parameters
try:
ro = _DataSelectRequestOptions(req.args)
ro.parse()
except ValueError, e:
Logging.warning(str(e))
return HTTP.renderErrorPage(req, http.BAD_REQUEST, str(e))
示例12: renderErrorPage
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def renderErrorPage(request, code, msg):
html = """\
<html>
<head><title>%i - %s</title></head>
<body>
<h1>%s</h1>
<p>%s</p>
</body>
</html>"""
request.setHeader("Content-Type", "text/html")
request.setResponseCode(code)
codeStr = http.RESPONSES[code]
Logging.warning("Responding with error: %i (%s)" % (code, codeStr))
return html % (code, codeStr, codeStr, msg)
示例13: resumeProducing
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def resumeProducing(self):
rec = None
try: rec = self.rsInput.next()
except Exception, e: Logging.warning("%s" % str(e))
if self.written == 0:
# read first record to test if any data exists at all
if not rec:
msg = "no waveform data found"
data = HTTP.renderErrorPage(self.req, http.NO_CONTENT, msg, self.ro)
if data:
self.req.write(data)
self.req.unregisterProducer()
self.req.finish()
return
self.req.setHeader('Content-Type', 'application/vnd.fdsn.mseed')
self.req.setHeader('Content-Disposition', "attachment; " \
"filename=%s" % self.fileName)
if not rec:
self.req.unregisterProducer()
Logging.debug("%s: returned %i bytes of mseed data" % (
self.ro.service, self.written))
utils.accessLog(self.req, self.ro, http.OK, self.written, None)
self.req.finish()
return
data = rec.raw().str()
self.req.write(data)
self.written += len(data)
示例14: resumeProducing
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def resumeProducing(self):
rec = None
try: rec = self.rsInput.next()
except Exception, e: Logging.warning("%s" % str(e)) # e.g. ArchiveException
if not self.initialized:
self.initialized = True
# read first record to test if any data exists at all
if not rec:
msg = "No waveform data found"
self.req.write(HTTP.renderErrorPage(self.req, http.NOT_FOUND, msg))
self.req.unregisterProducer()
self.req.finish()
return
self.req.setHeader("Content-Type", "application/vnd.fdsn.mseed")
self.req.setHeader("Content-Disposition", "attachment; filename=%s" % \
self.fileName)
if not rec:
self.req.unregisterProducer()
self.req.finish()
return
self.req.write(rec.raw().str())
示例15: _addStream
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
def _addStream(self, ro, streams, toks, lastFileName):
start, end = Time(), Time()
if start.fromString("%s.%s" % (toks[4], toks[5]), "%Y.%j") and \
end.fromString(lastFileName[-8:] + "23:59:59", "%Y.%j%T"):
# match time
if ro.time.start > end or \
(ro.time.end and ro.time.end < start):
return
# limit time to requested time
if ro.time.start > start:
start = ro.time.start
if ro.time.end and ro.time.end < end:
end = ro.time.end
streams.append((toks[1], toks[2], start, end))
else:
Logging.warning("invalid stream information: %s%s.%s" % (
toks[0], toks[1], toks[2]))