@@ -112,22 +112,8 @@ sms.send_message({
112112})
113113```
114114
115-
116115### Send SMS with unicode
117116
118- ``` python
119- responseData = client.send_message({
120- ' from' : NEXMO_BRAND_NAME ,
121- ' to' : TO_NUMBER ,
122- ' text' : ' こんにちは世界' ,
123- ' type' : ' unicode' ,
124- })
125- ```
126-
127- Reference: [ Send sms with unicode] ( https://developer.nexmo.com/messaging/sms/code-snippets/send-an-sms-with-unicode )
128-
129- ** Using Sms Class**
130-
131117``` python
132118sms.send_message({
133119 ' from' : NEXMO_BRAND_NAME ,
@@ -139,12 +125,6 @@ sms.send_message({
139125
140126### Submit SMS Conversion
141127
142- ``` python
143- client.submit_sms_conversion(" a-message-id" )
144- ```
145-
146- ** With the SMS Class**
147-
148128``` python
149129from nexmo import Client, Sms
150130client = Client(key = NEXMO_API_KEY , secret = NEXMO_SECRET )
@@ -173,8 +153,6 @@ voice.create_all({
173153})
174154```
175155
176- Testing screenshots:[ create call] ( https://gitlab.com/codeonrocks/client/nexmo-python/uploads/fc104415f55a4ad22ecf8defd90b926b/NexmoVoiceUsage.PNG )
177-
178156### Retrieve a list of calls
179157
180158``` python
@@ -294,55 +272,146 @@ voice.send_dtmf(response['uuid'], digits='1234')
294272response = client.get_recording(RECORDING_URL )
295273```
296274
297- ## Verify API
275+ # Verify Class
276+
277+ ## Creating an instance of the class
298278
299- ### Start a verification
279+ To create an instance of the Verify class, Just follow these steps:
280+
281+ - ** Import the class from module** (3 different ways)
300282
301283``` python
302- response = client.start_verification(number = ' 441632960960' , brand = ' MyApp' )
284+ # First way
285+ from nexmo import Verify
286+
287+ # Second way
288+ from nexmo.verify import Verify
289+
290+ # Third valid way
291+ import nexmo # then use nexmo.Verify() to create an instance
292+ ```
293+
294+ - ** Create the instance**
295+
296+ ``` python
297+ # First way - pass key and secret to the constructor
298+ verify = Verify(key = NEXMO_API_KEY , secret = NEXMO_API_SECRET )
299+
300+ # Second way - Create a client instance and then pass the client to the Verify contructor
301+ client = Client(key = NEXMO_API_KEY , secret = NEXMO_API_SECRET )
302+ verify = Verify(client)
303+ ```
304+
305+ ### Search for a Verification request
306+
307+ ``` python
308+ client = Client(key = ' API_KEY' , secret = ' API_SECRET' )
309+
310+ verify = Verify(client)
311+ response = verify.search(' 69e2626cbc23451fbbc02f627a959677' )
303312
304- if response[' status' ] == ' 0' :
305- print (' Started verification request_id={request_id} ' .format(request_id = response[' request_id' ]))
313+ if response is not None :
314+ print (response[' status' ])
315+ ```
316+
317+ ### Send verification code
318+
319+ ``` python
320+ client = Client(key = ' API_KEY' , secret = ' API_SECRET' )
321+
322+ verify = Verify(client)
323+ response = verify.request(number = RECIPIENT_NUMBER , brand = ' AcmeInc' )
324+
325+ if response[" status" ] == " 0" :
326+ print (" Started verification request_id is %s " % (response[" request_id" ]))
306327else :
307- print (' Error:' , response[' error_text' ])
328+ print (" Error: %s " % response[" error_text" ])
308329```
309330
310- Docs: [ https://developer.nexmo.com/api/verify#verify-request ] ( https://developer.nexmo.com/api/verify?utm_source=DEV_REL&utm_medium=github&utm_campaign=python-client-library#verify-request )
331+ ### Send verification code with workflow
311332
312- The response contains a verification request id which you will need to
313- store temporarily (in the session, database, url, etc).
333+ ``` python
334+ client = Client( key = ' API_KEY ' , secret = ' API_SECRET ' )
314335
315- ### Check a verification
336+ verify = Verify(client)
337+ response = verify.request(number = RECIPIENT_NUMBER , brand = ' AcmeInc' , workflow_id = 1 )
338+
339+ if response[" status" ] == " 0" :
340+ print (" Started verification request_id is %s " % (response[" request_id" ]))
341+ else :
342+ print (" Error: %s " % response[" error_text" ])
343+ ```
344+
345+ ### Check verification code
316346
317347``` python
318- response = client.check_verification(' 00e6c3377e5348cdaf567e1417c707a5' , code = ' 1234' )
348+ client = Client(key = ' API_KEY' , secret = ' API_SECRET' )
349+
350+ verify = Verify(client)
351+ response = verify.check(REQUEST_ID , code = CODE )
319352
320- if response[' status' ] == ' 0 ' :
321- print (' Verification complete , event_id= {event_id} ' .format( event_id = response[' event_id' ]))
353+ if response[" status" ] == " 0 " :
354+ print (" Verification successful , event_id is %s " % ( response[" event_id" ]))
322355else :
323- print (' Error:' , response[' error_text' ])
356+ print (" Error: %s " % response[" error_text" ])
324357```
325358
326- Docs: [ https://developer.nexmo.com/api/verify#verify-check ] ( https://developer.nexmo.com/api/verify?utm_source=DEV_REL&utm_medium=github&utm_campaign=python-client-library#verify-check )
359+ ### Cancel Verification Request
327360
328- The verification request id comes from the call to the start_verification method.
329- The PIN code is entered into your application by the user.
361+ ``` python
362+ client = Client( key = ' API_KEY ' , secret = ' API_SECRET ' )
330363
331- ### Cancel a verification
364+ verify = Verify(client)
365+ response = verify.cancel(REQUEST_ID )
366+
367+ if response[" status" ] == " 0" :
368+ print (" Cancellation successful" )
369+ else :
370+ print (" Error: %s " % response[" error_text" ])
371+ ```
372+
373+ ### Trigger next verification proccess
332374
333375``` python
334- client.cancel_verification(' 00e6c3377e5348cdaf567e1417c707a5' )
376+ client = Client(key = ' API_KEY' , secret = ' API_SECRET' )
377+
378+ verify = Verify(client)
379+ response = verify.trigger_next_event(REQUEST_ID )
380+
381+ if response[" status" ] == " 0" :
382+ print (" Next verification stage triggered" )
383+ else :
384+ print (" Error: %s " % response[" error_text" ])
335385```
336386
337- Docs: [ https://developer.nexmo.com/api/verify#verify-control ] ( https://developer.nexmo.com/api/verify?utm_source=DEV_REL&utm_medium=github&utm_campaign=python-client-library#verify-control )
387+ ### Send payment authentication code
388+
389+ ``` python
390+ client = Client(key = ' API_KEY' , secret = ' API_SECRET' )
391+
392+ verify = Verify(client)
393+ response = verify.psd2(number = RECIPIENT_NUMBER , payee = PAYEE , amount = AMOUNT )
394+
395+ if response[" status" ] == " 0" :
396+ print (" Started PSD2 verification request_id is %s " % (response[" request_id" ]))
397+ else :
398+ print (" Error: %s " % response[" error_text" ])
399+ ```
338400
339- ### Trigger next verification step
401+ ### Send payment authentication code with workflow
340402
341403``` python
342- client.trigger_next_verification_event(' 00e6c3377e5348cdaf567e1417c707a5' )
404+ client = Client(key = ' API_KEY' , secret = ' API_SECRET' )
405+
406+ verify = Verify(client)
407+ verify.psd2(number = RECIPIENT_NUMBER , payee = PAYEE , amount = AMOUNT , workflow_id: WORKFLOW_ID )
408+
409+ if response[" status" ] == " 0" :
410+ print (" Started PSD2 verification request_id is %s " % (response[" request_id" ]))
411+ else :
412+ print (" Error: %s " % response[" error_text" ])
343413```
344414
345- Docs: [ https://developer.nexmo.com/api/verify#verify-control ] ( https://developer.nexmo.com/api/verify?utm_source=DEV_REL&utm_medium=github&utm_campaign=python-client-library#verify-control )
346415
347416## Number Insight API
348417
0 commit comments