uri的校验 匹配 http://0.0.0.0:55
nd = {}
nd['uuid'] = uuid.encode('utf-8')
res = re.match(r"(http://){1}([\d]{2,3}([.]{1}" +
"[\d]{1,3}){3}[:]{1}[\d]{2,5}){1}",uri)
if res == None:
return http_client.BAD_REQUEST,{'error': 'uri illegal'}
if 'gffgfgg' and 'ghrefgfg' not in body.keys():
LOG.error('create Failed with body paras error')
return http_client.BAD_REQUEST,{'error': 'create error'}
nd['dcId'] = body['dcId'].encode('utf-8')
变量匹配 小写字母打头 只包含字母和数字的
m1 = re.match(r"(^[a-z]){1}",bianliang)
m2 = re.search(r"([^a-z0-9])+",bianliang)
if m1 == None and m2:
return http_client.BAD_REQUEST,{'error': 'params bianliangillegal!'}