• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python uuid.uuid1函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中uuid.uuid1函数的典型用法代码示例。如果您正苦于以下问题:Python uuid1函数的具体用法?Python uuid1怎么用?Python uuid1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了uuid1函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: build_plentry_adds

    def build_plentry_adds(playlist_id, song_ids):
        """
        :param playlist_id
        :param song_ids
        """

        mutations = []

        prev_id, cur_id, next_id = None, str(uuid1()), str(uuid1())

        for i, song_id in enumerate(song_ids):
            m_details = {
                "clientId": cur_id,
                "creationTimestamp": "-1",
                "deleted": False,
                "lastModifiedTimestamp": "0",
                "playlistId": playlist_id,
                "source": 1,
                "trackId": song_id,
            }

            if song_id.startswith("T"):
                m_details["source"] = 2  # AA track

            if i > 0:
                m_details["precedingEntryId"] = prev_id
            if i < len(song_ids) - 1:
                m_details["followingEntryId"] = next_id

            mutations.append({"create": m_details})
            prev_id, cur_id, next_id = cur_id, next_id, str(uuid1())

        return mutations
开发者ID:virajkanwade,项目名称:Bunkford,代码行数:33,代码来源:mobileclient.py


示例2: recv_announce

    def recv_announce(self, expiration_time=None, traversal_id=None):
        msg = message.Announcement()
        self.guid = str(uuid.uuid1())
        msg.sender_id = self.guid
        msg.traversal_id = traversal_id or str(uuid.uuid1())

        return self.recv_msg(msg, expiration_time=expiration_time)
开发者ID:kowalski,项目名称:feat,代码行数:7,代码来源:common.py


示例3: test

def test():
    import uuid
    login_output = login_cli_by_account('admin', 'password')
    if login_output.find('%s >>>' % ('admin')) < 0:
        test_util.test_fail('zstack-cli is not display correct name for logined account: %s' % (login_output))

    account_name1 = uuid.uuid1().get_hex()
    account_pass1 = hashlib.sha512(account_name1).hexdigest()
    test_account1 = test_account.ZstackTestAccount()
    test_account1.create(account_name1, account_pass1)
    test_obj_dict.add_account(test_account1)
    login_output = login_cli_by_account(account_name1, account_name1)
    if login_output.find('%s >>>' % (account_name1)) < 0:
        test_util.test_fail('zstack-cli is not display correct name for logined account: %s' % (login_output))
    
    account_name2 = uuid.uuid1().get_hex()
    account_pass2 = hashlib.sha512(account_name2).hexdigest()
    test_account2 = test_account.ZstackTestAccount()
    test_account2.create(account_name2, account_pass2)
    test_obj_dict.add_account(test_account2)
    test_account_uuid2 = test_account2.get_account().uuid
    login_output = login_cli_by_account(account_name2, account_name2)
    if login_output.find('%s >>>' % (account_name2)) < 0:
        test_util.test_fail('zstack-cli is not display correct name for logined account %s' % (login_output))

    logout_output = logout_cli()
    if logout_output.find('- >>>') < 0:
        test_util.test_fail('zstack-cli is not display correct after logout: %s' % (login_output))

    test_account1.delete()
    test_account2.delete()
    test_obj_dict.rm_account(test_account1)
    test_obj_dict.rm_account(test_account2)
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:33,代码来源:test_multi_accounts_cli_login.py


示例4: file_upload

def file_upload(request):
    file = request.FILES.get('file', None)
    type = request.DATA.get('type', None)
    if file:
        # TODO: Streaming Video (FLV, F4V, MP4, 3GP) Streaming Audio (MP3, F4A, M4A, AAC)
        file_name = ''
        thumbnail = ''
        convert = Converter()
        if type == u'video/x-flv':
            uuid_string = str(uuid.uuid1())
            file_name = uuid_string + '.flv'
            thumbnail = uuid_string + '.jpg'
        elif type == u'video/mp4':
            uuid_string = str(uuid.uuid1())
            file_name = uuid_string + '.mp4'
            thumbnail = uuid_string + '.jpg'
        if file_name != '':
            file_path = FILE_PATH + file_name
            with open(file_path, 'wb+') as destination:
                for chunk in file.chunks():
                    destination.write(chunk)
                destination.close()
                convert.thumbnail(file_path, 10, FILE_PATH + thumbnail)
            temp_file = TempFile(name=file_name, path=file_path)
            temp_file.save()
            return Response({
                'file_name': file_name,
                'thumbnail': thumbnail
            })
        else:
            return Response({
                'status': 'Current just support .mp4 && .flv.'
            })
开发者ID:bcc0421,项目名称:MediaServer_Demo,代码行数:33,代码来源:views.py


示例5: request

    def request(self, view, request_type, callback, location=None):
        """
        Send request to daemon process

        :type view: sublime.View
        :type request_type: str
        :type callback: callabel
        :type location: type of (int, int) or None
        """
        logger.info('Sending request to daemon for "{0}"'.format(request_type))

        if location is None:
            location = view.sel()[0].begin()
        current_line, current_column = view.rowcol(location)
        source = view.substr(sublime.Region(0, view.size()))

        if PY3:
            uuid = uuid1().hex
        else:
            uuid = uuid1().get_hex()

        data = {
            'source': source,
            'line': current_line + 1,
            'offset': current_column,
            'filename': view.file_name() or '',
            'type': request_type,
            'uuid': uuid,
        }
        self.stdin.put_nowait((callback, data))
开发者ID:leiserfg,项目名称:SublimeJEDI,代码行数:30,代码来源:utils.py


示例6: us_classifications

 def us_classifications(self):
     """
     Returns list of dictionaries representing us classification
     main:
       class
       subclass
     """
     classes = []
     i = 0
     main = self.xml.classification_national.contents_of('main_classification')
     data = {'class': main[0][:3].replace(' ', ''),
             'subclass': main[0][3:].replace(' ', '')}
     if any(data.values()):
         classes.append([
             {'uuid': str(uuid.uuid1()), 'sequence': i},
             {'id': data['class'].upper()},
             {'id': "{class}/{subclass}".format(**data).upper()}])
         i = i + 1
     if self.xml.classification_national.further_classification:
         further = self.xml.classification_national.contents_of('further_classification')
         for classification in further:
             data = {'class': classification[:3].replace(' ', ''),
                     'subclass': classification[3:].replace(' ', '')}
             if any(data.values()):
                 classes.append([
                     {'uuid': str(uuid.uuid1()), 'sequence': i},
                     {'id': data['class'].upper()},
                     {'id': "{class}/{subclass}".format(**data).upper()}])
                 i = i + 1
     return classes
开发者ID:Grace,项目名称:patentprocessor,代码行数:30,代码来源:application_handler_v42.py


示例7: crawCompanyNews

def  crawCompanyNews(link):
    filterContext = ThemeNewsSpiderUtils.returnStartContext(link,'<div class="listnews" id="TacticNewsList1" >')
    startContext = ThemeNewsSpiderUtils.filterContextByTarget(filterContext,'<ul>','</ul>')
    len = ThemeNewsSpiderUtils.findAllTarget(startContext,'<li')
    newsFlag = 'good'
    currentList = []
    for  i in range(len):
        targetContext = ThemeNewsSpiderUtils.divisionTarget(startContext, '<li>', '</li>')
        startContext = targetContext['nextContext']
        currentcontext =  targetContext['targetContext']
        keyid = str(uuid.uuid1())
        linkUrl = ThemeNewsSpiderUtils.filterContextByTarget(currentcontext,'<a href="', '">')
        pubDate = ThemeNewsSpiderUtils.filterContextByTarget(currentcontext,'<span>','</span>')
        title = ThemeNewsSpiderUtils.filterContextByTarget(currentcontext,'">','</a>')
        if linkUrl != '':
            currentList.append([keyid,linkUrl,pubDate,title,newsFlag])
    
    currentFilterContext = ThemeNewsSpiderUtils.returnStartContext(link,'<div class="listnews" id="TacticNewsList2"  style="display:none;">')
    currentstartContext = ThemeNewsSpiderUtils.filterContextByTarget(currentFilterContext,'<ul>','</ul>')
    currentlen = ThemeNewsSpiderUtils.findAllTarget(currentstartContext,'<li')
    newsFlag = 'bad'
    for  m in range(currentlen):
        targetContext = ThemeNewsSpiderUtils.divisionTarget(currentstartContext, '<li>', '</li>')
        currentstartContext = targetContext['nextContext']
        currentcontext =  targetContext['targetContext']
        keyid = str(uuid.uuid1())
        linkUrl = ThemeNewsSpiderUtils.filterContextByTarget(currentcontext,'<a href="', '">')
        pubDate = ThemeNewsSpiderUtils.filterContextByTarget(currentcontext,'<span>','</span>')
        title = ThemeNewsSpiderUtils.filterContextByTarget(currentcontext,'">','</a>')
        if linkUrl != '':
            currentList.append([keyid,linkUrl,pubDate,title,newsFlag])
    return currentList
开发者ID:timedcy,项目名称:kttspider,代码行数:32,代码来源:ImportantNewsSpider.py


示例8: testCloneModelWithCheckpoint

  def testCloneModelWithCheckpoint(self):
    checkpointMgr = ModelCheckpointMgr()

    modelID = uuid.uuid1().hex
    destModelID = uuid.uuid1().hex

    # Create the source model with meta-info only (no checkpoint)
    modelDef = {'a': 1, 'b': 2, 'c':3}
    checkpointMgr.define(modelID, modelDef)

    # Create a model that we can clone
    model1 = ModelFactory.create(self._getModelParams("variant1"))
    checkpointMgr.save(modelID, model1, attributes="attributes1")

    # Clone the source model
    checkpointMgr.clone(modelID, destModelID)

    # Discard the source model checkpoint
    checkpointMgr.remove(modelID)

    # Verify that the destination model's definition is the same as the
    # source model's
    destModelDef = checkpointMgr.loadModelDefinition(destModelID)
    self.assertDictEqual(destModelDef, modelDef)

    # Verify that the destination model's attributes match the source's
    attributes = checkpointMgr.loadCheckpointAttributes(destModelID)
    self.assertEqual(attributes, "attributes1")

    # Attempt to load the cloned model from checkpoint
    model = checkpointMgr.load(destModelID)
    self.assertEqual(str(model.getFieldInfo()), str(model1.getFieldInfo()))
开发者ID:sergius,项目名称:numenta-apps,代码行数:32,代码来源:model_checkpoint_mgr_test.py


示例9: testRemoveAll

  def testRemoveAll(self):
    """
    Test removeAll
    """
    checkpointMgr = ModelCheckpointMgr()

    # Should be empty at first
    ids = checkpointMgr.getModelIDs()
    self.assertSequenceEqual(ids, [])


    # Create some checkpoints using meta info
    expModelIDs = [uuid.uuid1().hex, uuid.uuid1().hex]
    expModelIDs.sort()
    for modelID in expModelIDs:
      checkpointMgr.define(modelID, definition={'a':1})

    ids = checkpointMgr.getModelIDs()
    self.assertItemsEqual(ids, expModelIDs)

    # Delete checkpoint store
    ModelCheckpointMgr.removeAll()

    ids = checkpointMgr.getModelIDs()
    self.assertSequenceEqual(ids, [])
开发者ID:sergius,项目名称:numenta-apps,代码行数:25,代码来源:model_checkpoint_mgr_test.py


示例10: post

def post():
    try:
    # Get the parsed contents of the form data
      jsonr = request.json
      msg_uuid = uuid.uuid1()
#      pprint.pprint(jsonr)
      kind = jsonr['data']['kind']
      if 'drink_poured' in kind:
	user = jsonr['data']['user']['display_name']
        pour = jsonr['data']['drink']
        beverage = jsonr['data']['keg']['beverage']
	abv = jsonr['data']['keg']['type']['abv']
	style = jsonr['data']['keg']['type']['name']
	left = jsonr['data']['keg']['percent_full']

        producer = beverage['producer']['name']
        img_url = pour['images'][0]['original_url']
        drink = beverage['name']
	volume_ml = pour['volume_ml']
	pints = volume_ml * 0.00211338 

	message = "%s just poured %s pints of %s, a %s %s (%%%s). %%%s remains" % (user, round(pints, 3), drink, producer, style, abv, round(left, 3)) 
	print("Sending to dasher:\n channel: %s\nimg: %s\n message: %s" % (kb_channel_id, img_url, message))
	img_payload = { 'message': img_url, 'uuid': uuid.uuid1() }
        payload = { 'message': message, 'uuid': msg_uuid }
        r = requests.post(kb_post_url, data=img_payload)
        r = requests.post(kb_post_url, data=payload)
      
      # Render template
      return jsonify(jsonr)
    except Exception:
      traceback.print_exc(file=sys.stdout)
开发者ID:ahhdem,项目名称:kegbot-docker,代码行数:32,代码来源:kbdasher.py


示例11: testCloneModelWithDefinitionOnly

  def testCloneModelWithDefinitionOnly(self):
    checkpointMgr = ModelCheckpointMgr()

    modelID = uuid.uuid1().hex
    destModelID = uuid.uuid1().hex

    # Create the source model with meta-info only (no checkpoint)
    modelDef = {'a': 1, 'b': 2, 'c':3}
    checkpointMgr.define(modelID, modelDef)

    # Clone the source model
    checkpointMgr.clone(modelID, destModelID)

    # Verify that the destination model's definition is the same as the
    # source model's
    destModelDef = checkpointMgr.loadModelDefinition(destModelID)
    self.assertDictEqual(destModelDef, modelDef)

    # Calling load when the model checkpoint doesn't exist should raise an
    #  exception
    with self.assertRaises(ModelNotFound):
      checkpointMgr.load(destModelID)

    # Calling clone when the destination model archive already exists should
    # raise an exception
    with self.assertRaises(ModelAlreadyExists):
      checkpointMgr.clone(modelID, destModelID)
开发者ID:sergius,项目名称:numenta-apps,代码行数:27,代码来源:model_checkpoint_mgr_test.py


示例12: create_version_files

def create_version_files ():
    s =''
    s +="#ifndef __TREX_VER_FILE__           \n"
    s +="#define __TREX_VER_FILE__           \n"
    s +="#ifdef __cplusplus                  \n"
    s +=" extern \"C\" {                        \n"
    s +=" #endif                             \n";
    s +='#define  VERSION_USER  "%s"          \n' % os.environ.get('USER', 'unknown')
    s +='extern const char * get_build_date(void);  \n'
    s +='extern const char * get_build_time(void);  \n'
    s +='#define VERSION_UIID      "%s"       \n' % uuid.uuid1()
    s +='#define VERSION_BUILD_NUM "%s"       \n' % get_build_num()
    s +="#ifdef __cplusplus                  \n"
    s +=" }                        \n"
    s +=" #endif                             \n";
    s +="#endif \n"

    write_file (H_VER_FILE ,s)

    s ='#include "version.h"          \n'
    s +='#define VERSION_UIID1      "%s"       \n' % uuid.uuid1()
    s +="const char * get_build_date(void){ \n"
    s +="    return (__DATE__);       \n"
    s +="}      \n"
    s +=" \n"
    s +="const char * get_build_time(void){ \n"
    s +="    return (__TIME__ );       \n"
    s +="}      \n"

    write_file (C_VER_FILE,s)
开发者ID:Meghana-S,项目名称:trex-core,代码行数:30,代码来源:ws_main.py


示例13: test_package_serialization

    def test_package_serialization(self):
        items = [
            self.request_delivery_factory.factory_item(
                ware_key=uuid.uuid1().get_hex()[:10],
                cost=Decimal(450.0 * 30),
                payment=Decimal(450.0),
                weight=500,
                weight_brutto=600,
                amount=4,
                comment=u'Комментарий на русском',
                link=u'http://shop.ru/item/44'
            ),
            self.request_delivery_factory.factory_item(
                ware_key=uuid.uuid1().get_hex()[:10],
                cost=Decimal(250.0 * 30),
                payment=Decimal(250.0),
                weight=500,
                weight_brutto=600,
                amount=4,
                comment=u'Комментарий на русском',
                link=u'http://shop.ru/item/42'
            )
        ]

        package = self.request_delivery_factory.factory_package(
            number=uuid.uuid1().hex[:10],
            weight=3000,
            items=items
        )
        self.assertIsInstance(package, PackageRequestObject)
        tostring(package.to_xml_element(u'Package'), encoding='UTF-8').replace("'", "\"")
开发者ID:rebranch,项目名称:rebranch-cdek-api,代码行数:31,代码来源:tests.py


示例14: test_time_to_uuid

    def test_time_to_uuid(self):
        key = 'key1'
        timeline = []

        timeline.append(time.time())
        time1 = uuid1()
        col1 = {time1:'0'}
        self.cf_time.insert(key, col1)
        time.sleep(0.1)

        timeline.append(time.time())
        time2 = uuid1()
        col2 = {time2:'1'}
        self.cf_time.insert(key, col2)
        time.sleep(0.1)

        timeline.append(time.time())

        cols = {time1:'0', time2:'1'}

        assert_equal(self.cf_time.get(key, column_start=timeline[0])                            , cols)
        assert_equal(self.cf_time.get(key,                           column_finish=timeline[2]) , cols)
        assert_equal(self.cf_time.get(key, column_start=timeline[0], column_finish=timeline[2]) , cols)
        assert_equal(self.cf_time.get(key, column_start=timeline[0], column_finish=timeline[2]) , cols)
        assert_equal(self.cf_time.get(key, column_start=timeline[0], column_finish=timeline[1]) , col1)
        assert_equal(self.cf_time.get(key, column_start=timeline[1], column_finish=timeline[2]) , col2)
开发者ID:enki,项目名称:pycassa,代码行数:26,代码来源:test_autopacking.py


示例15: start_format

    def start_format(self, **kwargs):
        account = kwargs['account']
        self.balance = account.balance
        self.coming = account.coming

        self.output(u'OFXHEADER:100')
        self.output(u'DATA:OFXSGML')
        self.output(u'VERSION:102')
        self.output(u'SECURITY:NONE')
        self.output(u'ENCODING:USASCII')
        self.output(u'CHARSET:1252')
        self.output(u'COMPRESSION:NONE')
        self.output(u'OLDFILEUID:NONE')
        self.output(u'NEWFILEUID:%s\n' % uuid.uuid1())
        self.output(u'<OFX><SIGNONMSGSRSV1><SONRS><STATUS><CODE>0<SEVERITY>INFO</STATUS>')
        self.output(u'<DTSERVER>%s113942<LANGUAGE>ENG</SONRS></SIGNONMSGSRSV1>' % datetime.date.today().strftime('%Y%m%d'))
        self.output(u'<BANKMSGSRSV1><STMTTRNRS><TRNUID>%s' % uuid.uuid1())
        self.output(u'<STATUS><CODE>0<SEVERITY>INFO</STATUS><CLTCOOKIE>null<STMTRS>')
        self.output(u'<CURDEF>%s<BANKACCTFROM>' % (account.currency or 'EUR'))
        self.output(u'<BANKID>null')
        self.output(u'<BRANCHID>null')
        self.output(u'<ACCTID>%s' % account.id)
        try:
            account_type = self.TYPES_ACCTS[account.type]
        except IndexError:
            account_type = ''
        self.output(u'<ACCTTYPE>%s' % (account_type or 'CHECKING'))
        self.output(u'<ACCTKEY>null</BANKACCTFROM>')
        self.output(u'<BANKTRANLIST>')
        self.output(u'<DTSTART>%s' % datetime.date.today().strftime('%Y%m%d'))
        self.output(u'<DTEND>%s' % datetime.date.today().strftime('%Y%m%d'))
开发者ID:ngrislain,项目名称:weboob,代码行数:31,代码来源:boobank.py


示例16: issue_aft_token

def issue_aft_token():
    """
    Issues a new antiforgery token to include in a page request.
    If it doesn't exist in the request, sets a cookie in the response.
    @param request
    @returns {string} the newly defined
    """
    # check if the session is defined inside the request
    if not request.session:
        raise Error("missing session inside the request object; use the AntiforgeryValidate after the membership provider")
    encryption_key = request.session.guid

    cookie_token = request.cookies.get(cookie_name)
    new_token_defined = False
    if not cookie_token:
        #define a new token
        cookie_token = uuid.uuid1()
        new_token_defined = True
    else:
        can_decrypt, value = AesEncryptor.try_decrypt(cookie_token, encryption_key)
        if not can_decrypt:
            cookie_token = uuid.uuid1()
            new_token_defined = True
        else:
            # use the same value of before
            cookie_token = value

    if new_token_defined:
        cookie_token = str(cookie_token)
        encrypted_token = AesEncryptor.encrypt(cookie_token, str(encryption_key))
        # the cookie will be set in response object inside global_handlers function
        request.set_aft_cookie = encrypted_token

    # return the token encrypted with AES; many calls always return a different value
    return AesEncryptor.encrypt(cookie_token, encryption_key)
开发者ID:RobertoPrevato,项目名称:flask-three-template,代码行数:35,代码来源:antiforgery.py


示例17: get_or_create_user

def get_or_create_user(first_name=None, last_name=None, always_new=True):
    if always_new == False:
        # if it's false, we will randomly decide whether we want to make a new case or not.
        if random.random() > CREATE_NEW_PERCENTAGE:
            # let's do a 25/75 create/existing split
            print "Returning existing user"
            return User.objects.all()[random.randrange(0, User.objects.all().count())]
        else:
            print "Creating new user"

    user = User()

    if first_name == None:
        user.first_name = uuid.uuid1().hex[0:20]
    else:
        user.first_name = first_name

    if last_name == None:
        user.last_name = uuid.uuid1().hex[0:20]
    else:
        user.last_name = last_name

    username = "%s_%s" % (user.first_name.replace("'", ""), user.last_name.replace("'", ""))
    user.username = username[0:30].lower()
    try:
        exists = User.objects.get(username=user.username)
        return exists
    except:
        user.save()
    return user
开发者ID:dimagi,项目名称:carehq,代码行数:30,代码来源:generator.py


示例18: test_stmtref_in_context_stmt

    def test_stmtref_in_context_stmt(self):
        stmt_guid = str(uuid.uuid1())

        existing_stmt = json.dumps({'actor':{'objectType':'Agent','mbox':'mailto:[email protected]'},
            'verb': {"id":"verb:verb/url/outer"},"object": {'id':'act:activityy16'}})
        path = "%s?%s" % (reverse('lrs:statements'), urllib.urlencode({"statementId":stmt_guid}))
        response = self.client.put(path, existing_stmt, content_type="application/json",
            Authorization=self.auth, X_Experience_API_Version=settings.XAPI_VERSION)
        self.assertEqual(response.status_code, 204)

        guid = str(uuid.uuid1())
        stmt = json.dumps({'actor':{'objectType':'Agent','mbox':'mailto:[email protected]'},
                'verb': {"id":"verb:verb/url"},"object": {'id':'act:activity16'},
                'context':{'registration': guid, 'contextActivities': {'other': {'id': 'act:NewActivityID'}},
                'revision': 'foo', 'platform':'bar','language': 'en-US',
                'statement': {'objectType': 'StatementRef','id': stmt_guid}}})
        response = self.client.post(reverse('lrs:statements'), stmt, content_type="application/json",
            Authorization=self.auth, X_Experience_API_Version=settings.XAPI_VERSION)
        self.assertEqual(response.status_code, 200)
        stmt_id = json.loads(response.content)[0]
        stmt = Statement.objects.get(statement_id=stmt_id)

        activity = Activity.objects.get(id=stmt.object_activity.id)
        st = Statement.objects.get(id=stmt.id)

        self.assertEqual(st.object_activity.id, activity.id)
        self.assertEqual(st.context_registration, guid)
        self.assertEqual(st.context_revision, 'foo')
        self.assertEqual(st.context_platform, 'bar')
        self.assertEqual(st.context_language, 'en-US')
开发者ID:chris-skud,项目名称:ADL_LRS,代码行数:30,代码来源:test_StatementManager.py


示例19: sendMessageToInputQueue

def sendMessageToInputQueue(q, anim_name,frame_file,type,userid):
    # Data required by the API
    if type == 'Frame':
        data = {
            'msgtype': str(type),
            'submitdate': time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime()),
            'key': str(uuid.uuid1()),#secret key/anwer to s3 instead of boto config file 
            'userid': str(userid), #or bucketname attribute
            'anim_name':str(anim_name),
            'frame_file': str(frame_file)
        }
    elif type == 'killCommand':
        data = {
            'msgtype': str(type),
            'submitdate': time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime()),
            'key': str(uuid.uuid1()),#secret key/anwer to s3 instead of boto config file 
            'userid': str(userid), #or bucketname attribute
            'command': str(message)
        }
    # Connect to SQS and open the queue
 
    # Put the message in the queue
    m = RawMessage()
    m.set_body(json.dumps(data))
    status = q.write(m)
开发者ID:helenaford,项目名称:ShadowCaster,代码行数:25,代码来源:queueOperator.py


示例20: setUp

    def setUp(self):
        super(SSLCertificateControllerTest, self).setUp()

        self.project_id = str(uuid.uuid1())
        self.service_name = str(uuid.uuid1())
        self.flavor_id = str(uuid.uuid1())

        # create a mock flavor to be used by new service creations
        flavor_json = {
            "id": self.flavor_id,
            "providers": [
                {
                    "provider": "mock",
                    "links": [
                        {
                            "href": "http://mock.cdn",
                            "rel": "provider_url"
                        }
                    ]
                }
            ]
        }
        response = self.app.post('/v1.0/flavors',
                                 params=json.dumps(flavor_json),
                                 headers={
                                     "Content-Type": "application/json",
                                     "X-Project-ID": self.project_id})

        self.assertEqual(201, response.status_code)
开发者ID:pombredanne,项目名称:poppy,代码行数:29,代码来源:test_ssl_certificate.py



注:本文中的uuid.uuid1函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python uuid.uuid3函数代码示例发布时间:2022-05-26
下一篇:
Python uuid.uuid函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap