text
stringlengths 0
828
|
---|
desc += ""URL: {url}\n""
|
desc += ""Request Type: {type}\n""
|
desc += ""User-Agent: {userAgent}\n""
|
desc += ""Contact: {contact}\n""
|
desc += ""\n""
|
output['message'] += desc.format(**event)
|
return output"
|
4661,"def flush_events(self):
|
""""""Flush events from the cloud node.""""""
|
response = self._send_data('DELETE', 'admin', 'flush-events', {})
|
if response['success']:
|
msg = ""Events flushed""
|
else:
|
msg = ""Flushing of events failed""
|
output = {'message': msg}
|
return output"
|
4662,"def put(self):
|
""""""Push the info represented by this ``Metric`` to CloudWatch.""""""
|
try:
|
self.cloudwatch.put_metric_data(
|
Namespace=self.namespace,
|
MetricData=[{
|
'MetricName': self.name,
|
'Value': self.value,
|
'Timestamp': self.timestamp
|
}]
|
)
|
except Exception:
|
logging.exception(""Error pushing {0} to CloudWatch."".format(str(self)))"
|
4663,"def log(self, message, level=logging.INFO, *args, **kwargs):
|
"""""" Send log entry
|
:param str message: log message
|
:param int level: `Logging level <https://docs.python.org/3/library/logging.html#levels>`_
|
:param list args: log record arguments
|
:param dict kwargs: log record key argument
|
""""""
|
msg = ""{}.{}: {}[{}]: {}"".format(
|
self.__class__.__name__, self.status, self.__class__.path,
|
self.uuid, message
|
)
|
extra = kwargs.pop(""extra"", dict())
|
extra.update(dict(kmsg=Message(
|
self.uuid, entrypoint=self.__class__.path, params=self.params,
|
metadata=self.metadata
|
).dump()))
|
return logger.log(
|
level=level, msg=msg, extra=extra, *args, **kwargs
|
)"
|
4664,"def setFocus(self, reason=None):
|
""""""Sets focus to first field. Note: reason is ignored.""""""
|
self.formLayout.itemAt(0, QFormLayout.FieldRole).widget().setFocus()"
|
4665,"def _connect(self):
|
""""""
|
Connect to a RabbitMQ instance
|
:returns: Boolean corresponding to success of connection
|
:rtype: bool
|
""""""
|
logger.info(""Connecting to rabbit"")
|
for url in self._urls:
|
try:
|
self._connection = pika.BlockingConnection(pika.URLParameters(url))
|
self._channel = self._connection.channel()
|
self._declare()
|
if self._confirm_delivery:
|
self._channel.confirm_delivery()
|
logger.info(""Enabled delivery confirmation"")
|
logger.debug(""Connected to rabbit"")
|
return True
|
except pika.exceptions.AMQPConnectionError:
|
logger.exception(""Unable to connect to rabbit"")
|
continue
|
except Exception:
|
logger.exception(""Unexpected exception connecting to rabbit"")
|
continue
|
raise pika.exceptions.AMQPConnectionError"
|
4666,"def _disconnect(self):
|
""""""
|
Cleanly close a RabbitMQ connection.
|
:returns: None
|
""""""
|
try:
|
self._connection.close()
|
logger.debug(""Disconnected from rabbit"")
|
except Exception:
|
logger.exception(""Unable to close connection"")"
|
4667,"def publish_message(self, message, content_type=None, headers=None, mandatory=False, immediate=False):
|
""""""
|
Publish a response message to a RabbitMQ instance.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.