|
| 1 | +import re |
1 | 2 | import sys |
2 | 3 | import requests |
3 | 4 | import warnings |
4 | 5 | from requests.adapters import HTTPAdapter |
5 | 6 | from requests.packages.urllib3.util.retry import Retry |
6 | 7 | from .download import FrameioDownloader |
| 8 | +from .exceptions import PresentationException |
7 | 9 |
|
8 | 10 | if sys.version_info.major >= 3: |
9 | 11 | from .py3_uploader import FrameioUploader |
@@ -75,6 +77,9 @@ def _api_call(self, method, endpoint, payload={}): |
75 | 77 | ) |
76 | 78 |
|
77 | 79 | return r.json() |
| 80 | + |
| 81 | + if r.status_code == 422 and "presentation" in endpoint: |
| 82 | + raise PresentationException |
78 | 83 |
|
79 | 84 | return r.raise_for_status() |
80 | 85 |
|
@@ -411,6 +416,26 @@ def get_review_links(self, project_id): |
411 | 416 | endpoint = '/projects/{}/review_links'.format(project_id) |
412 | 417 | return self._api_call('get', endpoint) |
413 | 418 |
|
| 419 | + def create_presentation_link(self, asset_id, **kwargs): |
| 420 | + """ |
| 421 | + Create a presentation link. |
| 422 | +
|
| 423 | + :Args: |
| 424 | + asset_id (string): The asset id. |
| 425 | + :Kwargs: |
| 426 | + kwargs: additional request parameters. |
| 427 | +
|
| 428 | + Example:: |
| 429 | +
|
| 430 | + client.create_presentation_link( |
| 431 | + asset_id="9cee7966-4066-b326-7db1-f9e6f5e929e4", |
| 432 | + title="My fresh presentation", |
| 433 | + password="abc123" |
| 434 | + ) |
| 435 | + """ |
| 436 | + endpoint = '/assets/{}/presentations'.format(asset_id) |
| 437 | + return self._api_call('post', endpoint, payload=kwargs) |
| 438 | + |
414 | 439 | def create_review_link(self, project_id, **kwargs): |
415 | 440 | """ |
416 | 441 | Create a review link. |
|
0 commit comments