Skip to content

Commit a3ba43c

Browse files
committed
prepare for v4 beta release
1 parent 329d775 commit a3ba43c

File tree

4 files changed

+73
-25
lines changed

4 files changed

+73
-25
lines changed

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
99
![Total lines](https://sloc.xyz/github/vonage/vonage-python-sdk)
1010

11-
This is the Python server SDK for Vonage's API. To use it you'll
12-
need a Vonage account. Sign up [for free at vonage.com][signup].
11+
This is the Python server SDK to help you use Vonage APIs in your Python application. To use it you'll need a Vonage account. [Sign up for free on the Vonage site](https://ui.idp.vonage.com/ui/auth/registration).
12+
13+
### Contents:
1314

1415
- [Installation](#installation)
1516
- [Migration Guides](#migration-guides)
@@ -35,6 +36,7 @@ need a Vonage account. Sign up [for free at vonage.com][signup].
3536
- [Frequently Asked Questions](#frequently-asked-questions)
3637
- [Contributing](#contributing)
3738
- [License](#license)
39+
- [Additional Resources](#additional-resources)
3840

3941
## Installation
4042

@@ -1381,7 +1383,6 @@ The following is a list of Vonage APIs and whether the Python SDK provides suppo
13811383
| API | API Release Status | Supported? |
13821384
| --------------------- | :------------------: | :--------: |
13831385
| Account API | General Availability ||
1384-
| Alerts API | General Availability ||
13851386
| Application API | General Availability ||
13861387
| Audit API | Beta ||
13871388
| Conversation API | Beta ||
@@ -1405,7 +1406,7 @@ The following is a list of Vonage APIs and whether the Python SDK provides suppo
14051406

14061407
[asyncio](https://docs.python.org/3/library/asyncio.html) is a library to write **concurrent** code using the **async/await** syntax.
14071408

1408-
We don't currently support asyncio in the Python SDK but we are planning to do so in upcoming releases.
1409+
We don't currently support asyncio in the Python SDK.
14091410

14101411
## Contributing
14111412

@@ -1414,13 +1415,13 @@ We :heart: contributions! But if you plan to work on something big or controvers
14141415
We recommend working on `vonage-python-sdk` with a [virtualenv][virtualenv]. The following command will install all the Python dependencies you need to run the tests:
14151416

14161417
```bash
1417-
make install
1418+
pip install -r requirements.txt
14181419
```
14191420

14201421
The tests are all written with pytest. You run them with:
14211422

14221423
```bash
1423-
make test
1424+
pytest -v
14241425
```
14251426

14261427
We use [Black](https://black.readthedocs.io/en/stable/index.html) for code formatting, with our config in the `pyproject.toml` file. To ensure a PR follows the right format, you can set up and use our pre-commit settings with
@@ -1433,10 +1434,11 @@ Then when you commit code, if it's not in the right format, it will be automatic
14331434

14341435
## License
14351436

1436-
This library is released under the [Apache License][license].
1437+
This library is released under the [Apache License](license).
1438+
1439+
## Additional Resources
14371440

1438-
[virtualenv]: https://virtualenv.pypa.io/en/stable/
1439-
[report-a-bug]: https://github.com/Vonage/vonage-python-sdk/issues/new
1440-
[pull-request]: https://github.com/Vonage/vonage-python-sdk/pulls
1441-
[signup]: https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=python-client-library
1442-
[license]: LICENSE.txt
1441+
- [Vonage Video API Developer Documentation](https://developer.vonage.com/en/video/overview)
1442+
- [Link to the Vonage Python SDK](https://github.com/Vonage/vonage-python-sdk)
1443+
- [Join the Vonage Developer Community Slack](https://developer.vonage.com/en/community/slack)
1444+
- [Submit a Vonage Video API Support Request](https://api.support.vonage.com/hc/en-us)

V3_TO_V4_SDK_MIGRATION_GUIDE.md

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Vonage Python SDK v3 to v4 Migration Guide
22

3-
This is a guide to help you migrate from using v3 of the Vonage Python SDK to using the new v4 `vonage` package. It has feature parity with the v3 package and contains many enhancements and structural changes. We will only be supporting v4 from its release.
3+
This is a guide to help you migrate from using v3 of the Vonage Python SDK to using the new v4 `vonage` package. It has feature parity with the v3 package and contains many enhancements and structural changes. We will only be supporting v4 from the time of its full release.
44

5-
The Vonage Python SDK (`vonage`) contains methods and data models to help you use many of Vonage's APIs. It also includes support for the new network APIs announced by Vonage.
5+
The Vonage Python SDK (`vonage`) contains methods and data models to help you use many of Vonage's APIs. It also includes support for the new mobile network APIs announced by Vonage.
66

77
## Contents
88

@@ -12,7 +12,10 @@ The Vonage Python SDK (`vonage`) contains methods and data models to help you us
1212
- [Accessing API Methods](#accessing-api-methods)
1313
- [Accessing API Data Models](#accessing-api-data-models)
1414
- [Response Objects](#response-objects)
15-
- [API Changes](#API-changes)
15+
- [Error Handling](#error-handling)
16+
- [General API Changes](#general-API-changes)
17+
- [Specific API Changes](#specific-api-changes)
18+
- [Method Name Changes](#method-name-changes)
1619
- [Additional Resources](#additional-resources)
1720

1821
## Structural Changes and Enhancements
@@ -46,7 +49,7 @@ You will notice that the dependent Vonage packages have been installed as well.
4649

4750
## Configuration
4851

49-
To get started with the v4 SDK, you'll need to initialize an instance of the `vonage.Vonage` class. This can then be used to access API methods. You need to provide authentication information and can optionally provide configuration options for the HTTP Client that's used (that is in the `vonage-http-client` package). This section will break all of this down then provide an example.
52+
To get started with the v4 SDK, you'll need to initialize an instance of the `vonage.Vonage` class. This can then be used to access API methods. You need to provide authentication information and can optionally provide configuration options for the HTTP Client used to make requests to Vonage APIs. This section will break all of this down then provide an example.
5053

5154
### Authentication
5255

@@ -120,7 +123,7 @@ response = vonage_client.verify_v2.start_verification(verify_request)
120123
print(response)
121124
```
122125

123-
However, some APIs with a lot of models have them located under the `vonage_api_package.models` package, e.g. `vonage-messages`, `vonage-voice` and `vonage-video`. To access these, simply import from `.models`, e.g. to send an image via Facebook Messenger do this:
126+
However, some APIs with a lot of models have them located under the `vonage_api_package.models` package, e.g. `vonage-messages`, `vonage-voice` and `vonage-video`. To access these, simply import from `vonage_api_package.models`, e.g. to send an image via Facebook Messenger do this:
124127

125128
```python
126129
from vonage_messages.models import MessengerImage, MessengerOptions, MessengerResource
@@ -154,27 +157,57 @@ print(settings.model_dump())
154157

155158
Response fields are also converted into snake_case where applicable, so as to be more pythonic. This means they won't necessarily match the API one-to-one.
156159

157-
## API Changes
160+
## Error Handling
161+
162+
In v3 of the SDK, most HTTP client errors gave a general `HttpClientError`. In v4 these are finer-grained. Errors in v4 inherit from the general `VonageError` but are more specific and finer-grained, E.g. a `RateLimitedError` when the SDK receives an HTTP 429 response.
163+
164+
These errors will have a descriptive message and will also include the response object returned to the SDK, accessed by `HttpClientError.response` etc.
165+
166+
Some API packages have their own errors for specific cases too.
167+
168+
For older Vonage APIs that always return an HTTP 200, error handling logic has been included to give a similar experience to the newer APIs.
169+
170+
## General API Changes
158171

159172
In v3, you access `vonage.Client`. In v4, it's `vonage.Vonage`.
160173

161174
The methods to get and set host attributes in v3 e.g. `vonage.Client.api_host` have been removed. You now get these options in v4 via the `vonage.Vonage.http_client`. Set these options in v4 by adding the options you want to the `vonage.HttpClientOptions` data model when initializing a `vonage.Vonage` object.
162175

163-
Rather than just returning a `ClientError` when an HTTP Client error is thrown, we now throw more specific errors with more information.
176+
## Specific API Changes
177+
178+
### Video API
179+
180+
Methods have been added to help you work with the Live Captions, Audio Connector and Experience Composer APIs. See the [Video API samples](video/README.md) for more information.
164181

165-
### Specific API Changes
182+
### Voice API
183+
184+
Methods have been added to help you moderate a voice call:
185+
186+
- `voice.hangup`
187+
- `voice.mute`
188+
- `voice.unmute`
189+
- `voice.earmuff`
190+
- `voice.unearmuff`
191+
192+
See the [Voice API samples](voice/README.md) for more information.
193+
194+
### Network Number Verification API
166195

167196
The process for verifying a number using the Network Number Verification API has been simplified. In v3 it was required to exchange a code for a token then use this token in the verify request. In v4, these steps are combined so both functions are taken care of in the `NetworkNumberVerification.verify` method.
168197

169-
Verify v2 functionality is accessed from `verify2` in v3 and `verify_v2` in v4.
198+
### Verify V2 API
199+
200+
Verify v2 functionality is accessed from `vonage_client.verify2` in v3 and `vonage_client.verify_v2` in v4.
201+
202+
### SMS API
170203

171-
SMS message signing/verifying signatures code in `vonage.Client` in v3 has been moved into the `vonage-http-client` package in v4. This can be accessed via the `vonage` package as we import the `vonage-http-client.Auth` class into its namespace.
204+
Code for signing/verifying signatures of SMS messages that was in the `vonage.Client` class in v3 has been moved into the `vonage-http-client` package in v4. This can be accessed via the `vonage` package as we import the `vonage-http-client.Auth` class into its namespace.
172205

173206
Old method -> new method
174207
`vonage.Client.sign_params` -> `vonage.Auth.sign_params`
175208
`vonage.Client.check_signature` -> `vonage.Auth.check_signature`
176209

177-
### Method Name Changes
210+
## Method Name Changes
178211

179212
Some methods from v3 have had their names changed in v4. Assuming you access all methods from the `vonage.Vonage` class in v4 with `vonage.Vonage.api_method` or the `vonage.Client` class in v3 with `vonage.Client.api_method`, this table details the changes:
180213

@@ -195,6 +228,19 @@ Some methods from v3 have had their names changed in v4. Assuming you access all
195228
| `verify.check` | `verify.check_code` |
196229
| `verify2.new_request` | `verify_v2.start_verification` |
197230
| `video.set_stream_layout` | `video.change_stream_layout` |
231+
| `video.create_archive` | `video.start_archive` |
232+
| `video.create_sip_call` | `video.initiate_sip_call` |
233+
| `voice.get_calls` | `voice.list_calls` |
234+
| `voice.update_call` | `voice.transfer_call_ncco` and `voice.transfer_call_answer_url` |
235+
| `voice.send_audio` | `voice.play_audio_into_call` |
236+
| `voice.stop_audio` | `voice.stop_audio_stream` |
237+
| `voice.send_speech` | `voice.play_tts_into_call` |
238+
| `voice.stop_speech` | `voice.stop_tts` |
239+
| `voice.send_dtmf` | `voice.play_dtmf_into_call` |
198240

199241
## Additional Resources
200242

243+
- [Vonage Video API Developer Documentation](https://developer.vonage.com/en/video/overview)
244+
- [Link to the Vonage Python SDK](https://github.com/Vonage/vonage-python-sdk)
245+
- [Join the Vonage Developer Community Slack](https://developer.vonage.com/en/community/slack)
246+
- [Submit a Vonage Video API Support Request](https://api.support.vonage.com/hc/en-us)

vonage/CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 4.0.0b0
1+
# 4.0.0b1
22
A complete, ground-up rewrite of the SDK.
33
Key changes:
44
- Monorepo structure, with each API under separate packages

vonage/src/vonage/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '4.0.0b0'
1+
__version__ = '4.0.0b1'

0 commit comments

Comments
 (0)