本文整理汇总了Python中sentry.options.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: lookup_system_symbols
def lookup_system_symbols(symbols, sdk_info=None, cpu_name=None):
"""Looks for system symbols in the configured system server if
enabled. If this failes or the server is disabled, `None` is
returned.
"""
if not options.get('symbolserver.enabled'):
return
url = '%s/lookup' % options.get('symbolserver.options')['url'].rstrip('/')
sess = Session()
symbol_query = {
'sdk_id': sdk_info_to_sdk_id(sdk_info),
'cpu_name': cpu_name,
'symbols': symbols,
}
attempts = 0
with sess:
while 1:
try:
rv = sess.post(url, json=symbol_query)
# If the symbols server does not know about the SDK at all
# it will report a 404 here. In that case just assume
# that we did not find a match and do not retry.
if rv.status_code == 404:
return None
rv.raise_for_status()
return rv.json()['symbols']
except (IOError, RequestException):
attempts += 1
if attempts > MAX_ATTEMPTS:
logger.error('Failed to contact system symbol server',
exc_info=True)
return
开发者ID:duanshuaimin,项目名称:sentry,代码行数:35,代码来源:systemsymbols.py
示例2: test_simple
def test_simple(self, safe_urlread, safe_urlopen):
self.create_project(platform='java')
safe_urlread.return_value = json.dumps({
'notices': [],
'version': {'stable': '1.0.0'},
})
with self.settings(SENTRY_ADMIN_EMAIL='[email protected]'):
send_beacon()
install_id = options.get('sentry:install-id')
assert install_id and len(install_id) == 40
safe_urlopen.assert_called_once_with(BEACON_URL, json={
'install_id': install_id,
'version': sentry.get_version(),
'data': {
'platforms': ['java'],
'organizations': 2,
'users': 2,
'projects': 2,
'teams': 2,
'events.24h': 0,
},
'admin_email': '[email protected]',
}, timeout=5)
safe_urlread.assert_called_once_with(safe_urlopen.return_value)
assert options.get('sentry:latest_version') == '1.0.0'
开发者ID:GpadillaQ,项目名称:sentry,代码行数:30,代码来源:test_beacon.py
示例3: test_simple
def test_simple(self, safe_urlread, safe_urlopen,
mock_get_all_package_versions):
mock_get_all_package_versions.return_value = {'foo': '1.0'}
safe_urlread.return_value = json.dumps({
'notices': [],
'version': {'stable': '1.0.0'},
})
assert options.set('system.admin-email', '[email protected]')
send_beacon()
install_id = options.get('sentry:install-id')
assert install_id and len(install_id) == 40
safe_urlopen.assert_called_once_with(BEACON_URL, json={
'install_id': install_id,
'version': sentry.get_version(),
'data': {
'organizations': 1,
'users': 0,
'projects': 1,
'teams': 1,
'events.24h': 0,
},
'admin_email': '[email protected]',
'packages': mock_get_all_package_versions.return_value,
}, timeout=5)
safe_urlread.assert_called_once_with(safe_urlopen.return_value)
assert options.get('sentry:latest_version') == '1.0.0'
开发者ID:280185386,项目名称:sentry,代码行数:30,代码来源:test_beacon.py
示例4: has_apps_configured
def has_apps_configured(self):
return bool(
options.get('github.apps-install-url') and
options.get('github.integration-app-id') and
options.get('github.integration-hook-secret') and
options.get('github.integration-private-key')
)
开发者ID:getsentry,项目名称:sentry-plugins,代码行数:7,代码来源:plugin.py
示例5: get_internal_source
def get_internal_source(project):
"""
Returns the source configuration for a Sentry project.
"""
internal_url_prefix = options.get('system.internal-url-prefix')
if not internal_url_prefix:
internal_url_prefix = options.get('system.url-prefix')
if sys.platform == 'darwin':
internal_url_prefix = internal_url_prefix \
.replace("localhost", "host.docker.internal") \
.replace("127.0.0.1", "host.docker.internal")
assert internal_url_prefix
sentry_source_url = '%s%s' % (
internal_url_prefix.rstrip('/'),
reverse('sentry-api-0-dsym-files', kwargs={
'organization_slug': project.organization.slug,
'project_slug': project.slug
})
)
return {
'type': 'sentry',
'id': 'sentry:project',
'url': sentry_source_url,
'token': get_system_token(),
}
开发者ID:getsentry,项目名称:sentry,代码行数:27,代码来源:symbolicator.py
示例6: _publish_to_kafka
def _publish_to_kafka(self, request):
"""
Sends raw event data to Kafka for later offline processing.
"""
try:
# This may fail when we e.g. send a multipart form. We ignore those errors for now.
data = request.body
if not data or len(data) > options.get('kafka-publisher.max-event-size'):
return
# Sampling
if random.random() >= options.get('kafka-publisher.raw-event-sample-rate'):
return
# We want to send only serializable items from request.META
meta = {}
for key, value in request.META.items():
try:
json.dumps([key, value])
meta[key] = value
except (TypeError, ValueError):
pass
meta['SENTRY_API_VIEW_NAME'] = self.__class__.__name__
kafka_publisher.publish(
channel=getattr(settings, 'KAFKA_RAW_EVENTS_PUBLISHER_TOPIC', 'raw-store-events'),
value=json.dumps([meta, base64.b64encode(data)])
)
except Exception as e:
logger.debug("Cannot publish event to Kafka: {}".format(e.message))
开发者ID:Kayle009,项目名称:sentry,代码行数:32,代码来源:api.py
示例7: get
def get(self, request, organization):
"""
Return chunk upload parameters
``````````````````````````````
:auth: required
"""
endpoint = options.get('system.upload-url-prefix')
# We fallback to default system url if config is not set
if len(endpoint) == 0:
endpoint = options.get('system.url-prefix')
url = reverse('sentry-api-0-chunk-upload', args=[organization.slug])
endpoint = urljoin(endpoint.rstrip('/') + '/', url.lstrip('/'))
return Response(
{
'url': endpoint,
'chunkSize': DEFAULT_BLOB_SIZE,
'chunksPerRequest': MAX_CHUNKS_PER_REQUEST,
'maxRequestSize': MAX_REQUEST_SIZE,
'concurrency': MAX_CONCURRENCY,
'hashAlgorithm': HASH_ALGORITHM,
'compression': ['gzip'],
}
)
开发者ID:alexandrul,项目名称:sentry,代码行数:25,代码来源:chunk.py
示例8: test_chunk_parameters
def test_chunk_parameters(self):
response = self.client.get(
self.url,
HTTP_AUTHORIZATION=u'Bearer {}'.format(self.token.token),
format='json'
)
endpoint = options.get('system.upload-url-prefix')
# We fallback to default system url if config is not set
if len(endpoint) == 0:
endpoint = options.get('system.url-prefix')
assert response.status_code == 200, response.content
assert response.data['chunkSize'] == CHUNK_UPLOAD_BLOB_SIZE
assert response.data['chunksPerRequest'] == MAX_CHUNKS_PER_REQUEST
assert response.data['maxRequestSize'] == MAX_REQUEST_SIZE
assert response.data['maxFileSize'] == options.get('system.maximum-file-size')
assert response.data['concurrency'] == MAX_CONCURRENCY
assert response.data['hashAlgorithm'] == HASH_ALGORITHM
assert response.data['url'] == options.get('system.url-prefix') + self.url
options.set('system.upload-url-prefix', 'test')
response = self.client.get(
self.url,
HTTP_AUTHORIZATION=u'Bearer {}'.format(self.token.token),
format='json'
)
assert response.data['url'] == options.get('system.upload-url-prefix') + self.url
开发者ID:Kayle009,项目名称:sentry,代码行数:29,代码来源:test_chunk_upload.py
示例9: u2f_appid
def u2f_appid(request):
facets = options.get("u2f.facets")
if not facets:
facets = [options.get("system.url-prefix")]
return HttpResponse(
json.dumps({"trustedFacets": [{"version": {"major": 1, "minor": 0}, "ids": [x.rstrip("/") for x in facets]}]}),
content_type="application/fido.trusted-apps+json",
)
开发者ID:ForkRepo,项目名称:sentry,代码行数:8,代码来源:twofactor.py
示例10: test_put_simple
def test_put_simple(self):
self.login_as(user=self.user)
assert options.get('mail.host') != 'lolcalhost'
response = self.client.put(self.url, {
'mail.host': 'lolcalhost',
})
assert response.status_code == 200
assert options.get('mail.host') == 'lolcalhost'
开发者ID:280185386,项目名称:sentry,代码行数:8,代码来源:test_system_options.py
示例11: status_mail
def status_mail(request):
form = TestEmailForm(request.POST or None)
if form.is_valid():
body = """This email was sent as a request to test the Sentry outbound email configuration."""
try:
send_mail(
"%s Test Email" % (options.get("mail.subject-prefix"),),
body,
options.get("mail.from"),
[request.user.email],
fail_silently=False,
)
except Exception as e:
form.errors["__all__"] = [six.text_type(e)]
return render_to_response(
"sentry/admin/status/mail.html",
{
"form": form,
"mail_host": options.get("mail.host"),
"mail_password": bool(options.get("mail.password")),
"mail_username": options.get("mail.username"),
"mail_port": options.get("mail.port"),
"mail_use_tls": options.get("mail.use-tls"),
"mail_from": options.get("mail.from"),
"mail_list_namespace": options.get("mail.list-namespace"),
},
request,
)
开发者ID:GeekGalaxy,项目名称:sentry,代码行数:30,代码来源:admin.py
示例12: status_mail
def status_mail(request):
form = TestEmailForm(request.POST or None)
if form.is_valid():
body = """This email was sent as a request to test the Sentry outbound email configuration."""
try:
send_mail(
'%s Test Email' % (options.get('mail.subject-prefix'), ),
body,
options.get('mail.from'), [request.user.email],
fail_silently=False
)
except Exception as e:
form.errors['__all__'] = [six.text_type(e)]
return render_to_response(
'sentry/admin/status/mail.html', {
'form': form,
'mail_host': options.get('mail.host'),
'mail_password': bool(options.get('mail.password')),
'mail_username': options.get('mail.username'),
'mail_port': options.get('mail.port'),
'mail_use_tls': options.get('mail.use-tls'),
'mail_from': options.get('mail.from'),
'mail_list_namespace': options.get('mail.list-namespace'),
}, request
)
开发者ID:NuttasitBoonwat,项目名称:sentry,代码行数:27,代码来源:admin.py
示例13: get_storage
def get_storage():
from sentry import options
backend = options.get('filestore.backend')
options = options.get('filestore.options')
try:
backend = settings.SENTRY_FILESTORE_ALIASES[backend]
except KeyError:
pass
storage = get_storage_class(backend)
return storage(**options)
开发者ID:alexandrul,项目名称:sentry,代码行数:12,代码来源:file.py
示例14: u2f_appid
def u2f_appid(request):
facets = options.get('u2f.facets')
if not facets:
facets = [options.get('system.url-prefix')]
return HttpResponse(json.dumps({
'trustedFacets': [{
'version': {
'major': 1,
'minor': 0
},
'ids': [x.rstrip('/') for x in facets]
}]
}), content_type='application/fido.trusted-apps+json')
开发者ID:Akashguharoy,项目名称:sentry,代码行数:13,代码来源:twofactor.py
示例15: _is_symbolicator_enabled
def _is_symbolicator_enabled(project, data):
if not options.get('symbolicator.enabled'):
return False
if project.get_option('sentry:symbolicator-enabled'):
return True
percentage = options.get('sentry:symbolicator-percent-opt-in') or 0
if percentage > 0:
id_bit = int(data['event_id'][4:6], 16)
return id_bit < percentage * 256
return False
开发者ID:yaoqi,项目名称:sentry,代码行数:13,代码来源:plugin.py
示例16: get_connection
def get_connection(fail_silently=False):
"""
Gets an SMTP connection using our OptionsStore
"""
return _get_connection(
backend=get_mail_backend(),
host=options.get('mail.host'),
port=options.get('mail.port'),
username=options.get('mail.username'),
password=options.get('mail.password'),
use_tls=options.get('mail.use-tls'),
fail_silently=fail_silently,
)
开发者ID:alshopov,项目名称:sentry,代码行数:13,代码来源:email.py
示例17: get
def get(self, request):
query = request.GET.get('query')
if query == 'is:required':
option_list = options.filter(flag=options.FLAG_REQUIRED)
elif query:
raise ValueError('{} is not a supported search query'.format(query))
else:
option_list = options.all()
results = {}
for k in option_list:
# TODO(mattrobenolt): Expose this as a property on Key.
diskPriority = bool(k.flags & options.FLAG_PRIORITIZE_DISK and settings.SENTRY_OPTIONS.get(k.name))
# TODO(mattrobenolt): help, placeholder, title, type
results[k.name] = {
'value': options.get(k.name),
'field': {
'default': k.default,
'required': bool(k.flags & options.FLAG_REQUIRED),
# We're disabled if the disk has taken priority
'disabled': diskPriority,
'disabledReason': 'diskPriority' if diskPriority else None,
}
}
return Response(results)
开发者ID:linniux,项目名称:sentry,代码行数:27,代码来源:system_options.py
示例18: check
def check(self):
last_ping = options.get('sentry:last_worker_ping') or 0
if last_ping >= time() - 300:
return []
return [
Problem("Background workers haven't checked in recently. This can mean an issue with your configuration or a serious backlog in tasks."),
]
开发者ID:TedaLIEz,项目名称:sentry,代码行数:7,代码来源:celery_ping.py
示例19: log_entry
def log_entry(entry, logger=logger):
"""
Give an AuditLogEntry object to the audit logger.
"""
fmt = options.get('system.logging-format')
if fmt == 'human':
log(
u'[Audit Log] [{org}] {user} {note}'.format(
org=entry.organization_id,
user=entry.actor_label,
note=entry.get_note(),
),
logger=logger,
)
elif fmt == 'machine':
log(
dict(
organization_id=entry.organization_id,
actor_id=entry.actor_id,
actor_key=entry.actor_key,
target_object=entry.target_object,
target_user_id=entry.target_user_id,
event=entry.get_event_display(),
ip_address=entry.ip_address,
data=entry.data,
datetime=entry.datetime,
),
logger=logger,
)
开发者ID:LordMike,项目名称:sentry,代码行数:29,代码来源:audit.py
示例20: send_confirm_email_singular
def send_confirm_email_singular(self, email, is_new_user=False):
from sentry import options
from sentry.utils.email import MessageBuilder
if not email.hash_is_valid():
email.set_hash()
email.save()
context = {
'user':
self,
'url':
absolute_uri(
reverse('sentry-account-confirm-email', args=[self.id, email.validation_hash])
),
'confirm_email':
email.email,
'is_new_user':
is_new_user,
}
msg = MessageBuilder(
subject='%sConfirm Email' % (options.get('mail.subject-prefix'), ),
template='sentry/emails/confirm_email.txt',
html_template='sentry/emails/confirm_email.html',
type='user.confirm_email',
context=context,
)
msg.send_async([email.email])
开发者ID:yogeshmangaj,项目名称:sentry,代码行数:28,代码来源:user.py
注:本文中的sentry.options.get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论