-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finish verify implementation and prepare for release
- Loading branch information
Showing
22 changed files
with
255 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"type": "https://developer.vonage.com/api-errors#forbidden", | ||
"title": "Forbidden", | ||
"detail": "Your account does not have permission to perform this action.", | ||
"instance": "bf0ca0bf927b3b52e3cb03217e1a1ddf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,63 @@ | ||
# Vonage Verify Package | ||
|
||
This package contains the code to use Vonage's Verify API in Python. There is a more current package to user Vonage's Verify v2 API which is recommended to use for most use cases. The v2 API lets you send messages via multiple channels, including Email, SMS, MMS, WhatsApp, Messenger and others. You can also make Silent Authentication requests with Verify v2 to give an end user a more seamless experience. | ||
|
||
This package includes methods for sending 2-factor authentication (2FA) messages and returns... | ||
|
||
|
||
asdf | ||
asdf | ||
This package contains the code to use Vonage's Verify API in Python. This package includes methods for working with 2-factor authentication (2FA) messages sent via SMS or TTS. | ||
|
||
Note: There is a more current package available: [Vonage's Verify v2 API](https://developer.vonage.com/en/verify/overview) which is recommended for most use cases. The v2 API lets you send messages via multiple channels, including Email, SMS, MMS, WhatsApp, Messenger and others. You can also make Silent Authentication requests with Verify v2 to give an end user a more seamless experience. | ||
|
||
## Usage | ||
|
||
It is recommended to use this as part of the main `vonage` package. The examples below assume you've created an instance of the `vonage.Vonage` class called `vonage_client`. | ||
|
||
### Make a Verify Request | ||
|
||
<!-- Create an `SmsMessage` object, then pass into the `Sms.send` method. | ||
```python | ||
from vonage_verify import VerifyRequest | ||
params = {'number': '1234567890', 'brand': 'Acme Inc.'} | ||
request = VerifyRequest(**params) | ||
response = vonage_client.verify.start_verification(request) | ||
``` | ||
|
||
### Make a PSD2 (Payment Services Directive v2) Request | ||
|
||
```python | ||
from vonage_verify import Psd2Request | ||
params = {'number': '1234567890', 'payee': 'Acme Inc.', 'amount': 99.99} | ||
request = VerifyRequest(**params) | ||
response = vonage_client.verify.start_verification(request) | ||
``` | ||
|
||
### Check a Verification Code | ||
|
||
```python | ||
vonage_client.verify.check_code(request_id='my_request_id', code='1234') | ||
``` | ||
|
||
### Search Verification Requests | ||
|
||
```python | ||
# Search for single request | ||
response = vonage_client.verify.search('my_request_id') | ||
|
||
# Search for multiple requests | ||
response = vonage_client.verify.search(['my_request_id_1', 'my_request_id_2']) | ||
``` | ||
|
||
### Cancel a Verification | ||
|
||
```python | ||
from vonage_sms import SmsMessage, SmsResponse | ||
response = vonage_client.verify.cancel_verification('my_request_id') | ||
``` | ||
|
||
message = SmsMessage(to='1234567890', from_='Acme Inc.', text='Hello, World!') | ||
response: SmsResponse = vonage_client.sms.send(message) | ||
### Trigger the Next Workflow Event | ||
|
||
print(response.model_dump(exclude_unset=True)) | ||
``` --> | ||
```python | ||
response = vonage_client.verify.trigger_next_event('my_request_id') | ||
``` | ||
|
||
### Request a Network Unblock | ||
|
||
Note: Network Unblock is switched off by default. Contact Sales to enable the Network Unblock API for your account. | ||
|
||
```python | ||
response = vonage_client.verify.request_network_unblock('23410') | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
# from .errors import PartialFailureError, SmsError | ||
from .errors import VerifyError | ||
from .language_codes import LanguageCode, Psd2LanguageCode | ||
from .requests import Psd2Request, VerifyRequest | ||
|
||
# from .responses import MessageResponse, SmsResponse | ||
from .responses import ( | ||
CheckCodeResponse, | ||
NetworkUnblockStatus, | ||
StartVerificationResponse, | ||
VerifyControlStatus, | ||
VerifyStatus, | ||
) | ||
from .verify import Verify | ||
|
||
__all__ = [ | ||
'Verify', | ||
'VerifyRequest', | ||
'VerifyError', | ||
'LanguageCode', | ||
'Psd2LanguageCode', | ||
'Psd2Request', | ||
'VerifyRequest', | ||
'CheckCodeResponse', | ||
'NetworkUnblockStatus', | ||
'StartVerificationResponse', | ||
'VerifyControlStatus', | ||
'VerifyStatus', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"network": "23410", | ||
"unblocked_until": "2024-04-22T08:34:58Z" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"type": "https://developer.vonage.com/api-errors#bad-request", | ||
"title": "Not Found", | ||
"detail": "The network you provided does not have an active block.", | ||
"instance": "bf0ca0bf927b3b52e3cb03217e1a1ddf" | ||
} |
Oops, something went wrong.