You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import os
import requests
hosts = os . getenv ( ' SERVER_LIB_URL ' , " http://127.0.0.1:5000 " )
#检验身份证号码
def checkIdCard ( id_card ) :
# 获取到url地址
url = hosts + " /id_card/verify "
# 请求参数
params = {
' idCardNo ' : id_card
}
# response = requests.get(url, params=params) 发送get请求
response = requests . post ( url , json = params )
return response . status_code == 200 and response . json ( ) . get ( " data " ) [ " result " ]
#检验银行卡号
def checkBankCard ( bank_card ) :
# 获取到url地址
url = hosts + " /bank/card_verify "
# 请求参数
params = {
' bankCard ' : bank_card
}
response = requests . post ( url , json = params )
return response . status_code == 200 and response . json ( ) . get ( " data " ) [ " result " ]
#检验手机号
def checkMobile ( mobile_no ) :
#获取到url地址
url = hosts + " /mobile/check "
#请求参数
params = {
' mobileNo ' : mobile_no
}
#获取到mobile_server类中返回的数据
response = requests . post ( url , json = params )
#判断返回数据的状态码和result(布尔值,手机号是否匹配成功), 只有状态码是200和手机号匹配成功才返回true
return response . status_code == 200 and response . json ( ) . get ( " data " ) [ " result " ]
def verifyOrderPayment ( order_no ) :
url = hosts + " /bank/query "
# 模拟向支付中心发送验证请求进行验证
params = { " OrderNo " : order_no }
response = requests . post ( url , json = params )
return response