Skip to content

Commit

Permalink
Merge pull request #257 from plivo/SMS-6606
Browse files Browse the repository at this point in the history
SMS-6606: OTP optional param added for create and validate session
  • Loading branch information
kanishka2104 authored Feb 14, 2024
2 parents d48b36d + aa24e42 commit 564a5f1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Change Log
## [4.48.0](https://github.com/plivo/plivo-python/tree/v4.48.0) (2024-02-12)
**Custom Verify OTP - Added new optional param 'otp' for Create Session and made 'otp' param optional for Validate Session**

## [4.47.2](https://github.com/plivo/plivo-python/tree/v4.47.2) (2024-01-25)
**Added new params 'create_mpc_with_single_participant' for Add Participant API of MPC**

Expand Down
4 changes: 2 additions & 2 deletions plivo/resources/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ class Sessions(PlivoResourceInterface):

@validate_args(
app_uuid=[optional(of_type(six.text_type))],
otp=[optional(of_type(six.text_type))],
recipient=[required(is_phonenumber())],
channel=[optional(all_of(of_type(six.text_type), is_in(('sms', 'voice'))))],
url=[optional(is_url())],
method=[optional(of_type(six.text_type))])
def create(self,
app_uuid=None,
otp=None,
recipient=None,
channel=None,
url=None,
Expand Down Expand Up @@ -91,8 +93,6 @@ def list(self,
session_uuid=[of_type(six.text_type)]
)
def validate(self, session_uuid, otp=None):
if otp is None:
raise ValidationError('otp is required')
return self.client.request('POST', ('Verify', 'Session', session_uuid),
to_param_dict(self.validate, locals()))

2 changes: 1 addition & 1 deletion plivo/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '4.47.2'
__version__ = '4.48.0'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name='plivo',
version='4.47.2',
version='4.48.0',
description='A Python SDK to make voice calls & send SMS using Plivo and to generate Plivo XML',
long_description=long_description,
url='https://github.com/plivo/plivo-python',
Expand Down
6 changes: 0 additions & 6 deletions tests/resources/test_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,3 @@ def test_validate(self):
self.assertEqual(test_session.message,
expected_response['message'])

def test_validate_without_otp(self):
self.assertRaises(
exceptions.ValidationError,
self.client.verify_session.validate,
session_uuid='1234567'
)

0 comments on commit 564a5f1

Please sign in to comment.