コード例 #1
0
 def _s3_key(self, main_dir, *subdirs, instance_key_or_id=None, absolute=False, encode=False):
     root_key = str_def(rconfig().aws.s3.root_key)
     if instance_key_or_id is None:
         ikey = ''
     elif instance_key_or_id in self.instances.keys():
         ikey = self.instances[instance_key_or_id].key
     else:
         ikey = instance_key_or_id
     tokens = [main_dir, ikey, *subdirs]
     if encode:
         tokens = map(uenc, tokens)
     rel_key = url_join(root_key, *tokens)
     return url_join('s3://', self.bucket.name, rel_key) if absolute else rel_key
コード例 #2
0
ファイル: script.py プロジェクト: kim135797531/cloudify-agent
 def _generate_script_path_and_url(self, script_filename):
     """
     Calculate install script's local path and download link
     :return: A tuple with:
     1. Path where the install script resides in the file server
     2. URL where the install script can be downloaded
     :rtype: (str, str)
     """
     # Store under cloudify_agent to avoid authentication
     script_relpath = os.path.join('cloudify_agent', script_filename)
     script_path = os.path.join(self.file_server_root, script_relpath)
     script_url = url_join(self.file_server_url, script_relpath)
     return script_path, script_url
コード例 #3
0
TIME_ZONE = 'US/Eastern'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = url_join(STATIC_URL, "admin/")

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'changeme'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
コード例 #4
0
ファイル: settings.py プロジェクト: dfeeney/recollection
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True


# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = url_join(STATIC_URL, "admin/")

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'changeme'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
    )

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
コード例 #5
0
ファイル: t_inception.py プロジェクト: abelweiwencai/practice
"""
试用inception
"""

import config

import requests
from rest_framework import status
from posixpath import join as url_join

notice_api = url_join('http://me:6061/', 'api/v2/dingtalk/notice/')

global_variables = globals()
ticket_id = 123
title = 'test'
content = 'content'
to = ['weiwencai']
print("\nticket_id: %s, to: %s, title: %s, ocntent: %s" %
      (ticket_id, to, title, content))


def main():
    data = {
        'ticket_id': ticket_id,
        'title': title,
        'content': content,
        'to': to
    }
    resp = requests.post(notice_api, json=data)
    if resp.status_code == status.HTTP_200_OK:
        print('通知发送成功')