本文整理汇总了Python中django.http.request.HttpRequest.get_full_path方法的典型用法代码示例。如果您正苦于以下问题:Python HttpRequest.get_full_path方法的具体用法?Python HttpRequest.get_full_path怎么用?Python HttpRequest.get_full_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.http.request.HttpRequest
的用法示例。
在下文中一共展示了HttpRequest.get_full_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_SMS
# 需要导入模块: from django.http.request import HttpRequest [as 别名]
# 或者: from django.http.request.HttpRequest import get_full_path [as 别名]
def process_SMS(request):
print HttpRequest.get_full_path(request)
tables_list = [[questionnaire], [answer], [data_from_public], [interview_data], [database.models.interview_details], [received_sms], [wfp_geosite], [wfp_personnels]]
if 'text' in request.GET and request.GET['text']:
sms = request.GET['text']
sms_from = request.GET['from']
print sms
print "1"
SMS_member_list = sms.split(" ")
print len(sms), len(SMS_member_list)
lock = database_lock.database_lock()
print "locking for %s"%SMS_member_list[0]
with lock.acquire_table_lock(tables_list):
print "locked for %s"%SMS_member_list[0]
if len(SMS_member_list)>1:
print "2"
sms_first_member = sms.split(" ", 1)
if sms_first_member[0].isdigit() == True:
print "3"
if len(SMS_member_list)<19:
print "4"
returned_answer_XML = "invalid sms"
#sys.exit("invalid sms")
else:
print "5"
returned_answer_XML = process_questionnaire_xml(SMS_member_list)
elif sms.split(' ')[0]=="incident":
result = check_user_database(sms_from)
if result=="ok" and len(sms.split("#")) == 1:
push_sms("wfp incident details#districts#reported by#occ.date#r.name#r.type#r.age#r.m/f#ward#site name", sms_from)
elif result=="ok" and len(sms.split("#")) > 1:
returned_answer_XML = generate_incident_answer_xml(sms, sms_from)
elif result == "number not registred":
returned_answer_XML = result+"wfp username password"
push_sms(result, sms_from)
push_sms("wfp username password", sms_from)
elif result == "username/password is changed. please re-register":
returned_answer_XML = result+"wfp username password"
push_sms(result, sms_from)
push_sms("wfp username password", sms_from)
else:
returned_answer_XML = result
push_sms(result, sms_from)
elif len(SMS_member_list)==2:
user_check = check_user(sms.split(" ")[0], sms.split(" ")[1])
if user_check is not None:
add = user_database.user_database()
result = add.add_to_user_database(user_check.split(",")[0], sms.split(" ")[0], sms.split(" ")[1], sms_from)
if result=="ok":
returned_answer_XML = "wfp incident details#districts#reported by#occ.date#r.name#r.type#r.age#r.m/f#ward#site name"
push_sms("wfp incident details#districts#reported by#occ.date#r.name#r.type#r.age#r.m/f#ward#site name", sms_from)
else:
returned_answer_XML = result
push_sms(result, sms_from)
else:
returned_answer_XML = "not a valid username/password" + "wfp username password"
push_sms("not a valid username/password", sms_from)
push_sms("wfp username password", sms_from)
elif SMS_member_list[0]=="disaster":
print "6"
send_sms = add_public_sms.public_sms()
print "6 1"
returned_answer_XML = send_sms.insert_sms_data(sms)
print "6 2", returned_answer_XML
#elif len(sms.split("#"))>4 and (sms.split("#",1))[0].isdigit()==True:
#print "7"
#returned_answer_XML = generate_incident_answer_xml(sms)
else:
returned_answer_XML = "invalid sms"
else:
print "8"
returned_answer_XML = "invalid sms"
pass
else:
print "9"
returned_answer_XML = "Answer XML creation Failed"
#return HttpResponse(returned_answer_XML)
return render(request, 'template3.html', {'answer_XML': returned_answer_XML})
#old working code from here
"""
示例2: generate_upload_path_hash
# 需要导入模块: from django.http.request import HttpRequest [as 别名]
# 或者: from django.http.request.HttpRequest import get_full_path [as 别名]
def generate_upload_path_hash(request: HttpRequest) -> str:
hasher = hashlib.sha256()
hasher.update(request.get_full_path().encode())
return hasher.hexdigest()