Skip to content

Commit 44f4c45

Browse files
committed
Merge from origin/master
2 parents c352e78 + 84cac98 commit 44f4c45

File tree

7 files changed

+35
-10
lines changed

7 files changed

+35
-10
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
strategy:
4444
max-parallel: 1
4545
matrix:
46-
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
46+
python-version: [3.6, 3.9]
4747
steps:
4848
- uses: actions/checkout@v2
4949
- name: Set up Python
@@ -57,7 +57,7 @@ jobs:
5757
pip install -e .'[test]'
5858
- name: Run tests with ${{ matrix.python-version }}
5959
env:
60-
APP_ID: YJRGphy60b8JCBib0vtDDtak-MdYXbMMI
60+
APP_ID: u5xB92MjVH94kH6p3M66DUua-MdYXbMMI
6161
APP_KEY: ${{ secrets.APP_KEY }}
6262
MASTER_KEY: ${{ secrets.MASTER_KEY }}
6363
USE_REGION: US

changelog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## [3.0.0] - 2022-11-24
2+
3+
## Change
4+
5+
- Drop support for python 2.7 and 3.5
6+
7+
## Fixed
8+
9+
- Require phone_number when verify sms code
10+
- Pinned urllib3 to 1.x
11+
112
## [2.9.12] - 2022-11-24
213

314
## Fixed

leancloud/user.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ def request_password_reset_by_sms_code(cls, phone_number, validate_token=None):
335335
client.post("/requestPasswordResetBySmsCode", params)
336336

337337
@classmethod
338-
def reset_password_by_sms_code(cls, sms_code, new_password):
339-
params = {"password": new_password}
338+
def reset_password_by_sms_code(cls, sms_code, new_password, phone_number):
339+
params = {"password": new_password, "mobilePhoneNumber": phone_number}
340340
client.put("/resetPasswordBySmsCode/" + sms_code, params)
341341

342342
# This should be an instance method.
@@ -359,8 +359,9 @@ def change_phone_number(cls, sms_code, phone_number):
359359
client.post("/changePhoneNumber", params)
360360

361361
@classmethod
362-
def verify_mobile_phone_number(cls, sms_code):
363-
client.post("/verifyMobilePhone/" + sms_code, {})
362+
def verify_mobile_phone_number(cls, sms_code, phone_number):
363+
params = {"mobilePhoneNumber": phone_number}
364+
client.post("/verifyMobilePhone/" + sms_code, params)
364365

365366
@classmethod
366367
def request_login_sms_code(cls, phone_number, validate_token=None):

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ six>=1.11.0
55
qiniu>=7.3.1
66
requests>=2.25.1
77
requests-toolbelt>=1.0.0
8+
urllib3<2
89
Werkzeug>=0.16.0,<2.0.0
910
secure-cookie>=0.1.0,<1.0.0
1011
gevent>=22.10.2,<23.0.0

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
setup(
2424
name='leancloud',
25-
version='2.9.12',
25+
version='3.0.0',
2626
description='LeanCloud Python SDK',
2727
url='https://leancloud.cn/',
2828
author='asaka',
@@ -34,8 +34,8 @@
3434
'Programming Language :: Python :: 2',
3535
'Programming Language :: Python :: 2.7',
3636
'Programming Language :: Python :: 3',
37-
'Programming Language :: Python :: 3.5',
3837
'Programming Language :: Python :: 3.6',
38+
'Programming Language :: Python :: 3.9',
3939
],
4040
keywords='Leancloud SDK',
4141
packages=find_packages(exclude=['docs', 'tests*']),

tests/test_engine.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,10 @@ def test_request_sms_code(): # type: () -> None
579579
pass
580580
elif e.code == 601 or e.error.startswith("SMS request too fast"): # send sms too frequently
581581
pass
582+
elif "SMS sending exceeds limit" in e.error:
583+
pass
584+
elif "send too frequently" in e.error:
585+
pass
582586
else:
583587
raise e
584588

tests/test_user.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,13 @@ def test_request_change_phone_number(): # type: () -> None
284284
# phone number is from http://www.z-sms.com
285285
User.request_change_phone_number("+8617180655340")
286286
except LeanCloudError as e:
287-
if e.code not in (119, 213, 601, 605):
287+
if e.code in (119, 213, 601, 605):
288+
pass
289+
elif "SMS sending exceeds limit" in e.error:
290+
pass
291+
elif "send too frequently" in e.error:
292+
pass
293+
else:
288294
raise e
289295
finally:
290296
user1.logout()
@@ -322,7 +328,9 @@ def test_request_password_reset_by_sms_code(): # type: () -> None
322328
def test_reset_password_by_sms_code(): # type: () -> None
323329
try:
324330
User.reset_password_by_sms_code(
325-
str(random.randrange(100000, 999999)), "password"
331+
str(random.randrange(100000, 999999)),
332+
"password",
333+
"1861111" + str(random.randrange(1000, 9999))
326334
)
327335
except LeanCloudError as e:
328336
if e.code != 603:

0 commit comments

Comments
 (0)