Exemple #1
0
def send_sms():
    json = request.get_json()
    phone_num = json.get('phone_num', '')
    if not phone_num:
        raise ParameterException()

    cloud.request_sms_code(phone_num)
    raise Success
def test_request_sms_code():  # type: () -> None
    if leancloud.client.REGION == 'US':
        return
    try:
        cloud.request_sms_code('13111111111')
    except LeanCloudError as e:
        # 短信发送过于频繁或者欠费或者关闭短信功能
        if e.code in (601, 160, 119):
            pass
        else:
            raise e
Exemple #3
0
def test_request_sms_code(): # type: () -> None
    if leancloud.client.REGION == 'US':
        return
    try:
        cloud.request_sms_code('13111111111')
    except LeanCloudError as e:
        # 短信发送过于频繁或者欠费或者关闭短信功能
        if e.code in (601, 160, 119):
            pass
        else:
            raise e
Exemple #4
0
def test_request_sms_code():  # type: () -> None
    try:
        # numbers come from http://www.z-sms.com/
        cloud.request_sms_code("+8617180655340")
        time.sleep(60)
        cloud.request_sms_code("+447365753569")
        time.sleep(60)
        cloud.request_sms_code("17180655340")
        time.sleep(60)
        cloud.request_sms_code("7365753569", idd="+44")
        time.sleep(60)
        cloud.request_sms_code("17180655340", idd="+86")
        time.sleep(60)
        cloud.request_sms_code("+447365753569", idd="+44")
        time.sleep(60)
        cloud.request_sms_code("+8617180655340", idd="+44")  # +8617180655340
        time.sleep(60)
        cloud.request_sms_code("+447365753569", idd="+86")  # +447365753569
    except LeanCloudError as e:
        # 短信发送过于频繁或者欠费或者关闭短信功能
        if e.code in (601, 605, 160, 119):
            pass
        else:
            raise e