Skip to content

Commit

Permalink
Add video api (#288)
Browse files Browse the repository at this point in the history
* move video module

* add video errors

* add video host and imports to client

* fix tests

* Update changelog and readme

* Bump version: 3.11.1 → 3.12.0

* add coming soon notice
  • Loading branch information
maxkahan committed Dec 11, 2023
1 parent 13808e1 commit cf51959
Show file tree
Hide file tree
Showing 27 changed files with 1,306 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.11.1
current_version = 3.12.0
commit = True
tag = False

Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 3.12.0
- Add support for the [Vonage Video API](https://developer.vonage.com/en/video/overview)

# 3.11.1
- Add checks for silent auth workflow optional parameters `redirect_url` and `sandbox`

Expand Down
1 change: 1 addition & 0 deletions OPENTOK_TO_VONAGE_MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Coming soon!
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ need a Vonage account. Sign up [for free at vonage.com][signup].
- [NCCO Builder](#ncco-builder)
- [Verify V2 API](#verify-v2-api)
- [Verify V1 API](#verify-v1-api)
- [Video API](#video-api)
- [Meetings API](#meetings-api)
- [Number Insight API](#number-insight-api)
- [Proactive Connect API](#proactive-connect-api)
Expand Down Expand Up @@ -595,6 +596,10 @@ else:
print("Error: %s" % response["error_text"])
```

## Video API

You can make calls to the Vonage Video API from this SDK. See the [Vonage Video API documentation](https://developer.vonage.com/en/video/overview) for detailed information and instructions on how to use the Vonage Python SDK with the Vonage Video API. Have a look at the SDK's [OpenTok to Vonage migration guide](OPENTOK_TO_VONAGE_MIGRATION.md) if you've previously used OpenTok.

## Meetings API

Full docs for the [Meetings API are available here](https://developer.vonage.com/en/meetings/overview).
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="vonage",
version="3.11.1",
version="3.12.0",
description="Vonage Server SDK for Python",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion src/vonage/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .client import *
from .ncco_builder.ncco import *

__version__ = "3.11.1"
__version__ = "3.12.0"
11 changes: 11 additions & 0 deletions src/vonage/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .subaccounts import Subaccounts
from .users import Users
from .ussd import Ussd
from .video import Video
from .voice import Voice
from .verify import Verify
from .verify2 import Verify2
Expand Down Expand Up @@ -91,6 +92,8 @@ def __init__(
self.api_key = key or os.environ.get("VONAGE_API_KEY", None)
self.api_secret = secret or os.environ.get("VONAGE_API_SECRET", None)

self.application_id = application_id

self.signature_secret = signature_secret or os.environ.get("VONAGE_SIGNATURE_SECRET", None)
self.signature_method = signature_method or os.environ.get("VONAGE_SIGNATURE_METHOD", None)

Expand All @@ -108,6 +111,7 @@ def __init__(
self._jwt_claims = {}
self._host = "rest.nexmo.com"
self._api_host = "api.nexmo.com"
self._video_host = "video.api.vonage.com"
self._meetings_api_host = "api-eu.vonage.com/v1/meetings"
self._proactive_connect_host = "api-eu.vonage.com"

Expand Down Expand Up @@ -135,6 +139,7 @@ def __init__(
self.ussd = Ussd(self)
self.verify = Verify(self)
self.verify2 = Verify2(self)
self.video = Video(self)
self.voice = Voice(self)

self.timeout = timeout
Expand All @@ -160,6 +165,12 @@ def api_host(self, value=None):
else:
self._api_host = value

def video_host(self, value=None):
if value is None:
return self._video_host
else:
self._video_host = value

# Gets and sets _meetings_api_host attribute
def meetings_api_host(self, value=None):
if value is None:
Expand Down
16 changes: 16 additions & 0 deletions src/vonage/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,21 @@ class ProactiveConnectError(ClientError):
"""An error relating to the Proactive Connect API."""


class VideoError(ClientError):
"""An error relating to the Video API."""


class UsersError(ClientError):
"""An error relating to the Users API."""


class InvalidRoleError(ClientError):
"""The specified role was invalid."""


class TokenExpiryError(ClientError):
"""The specified token expiry time was invalid."""


class SipError(ClientError):
"""Error related to usage of SIP calls."""
Loading

0 comments on commit cf51959

Please sign in to comment.