@@ -60,6 +60,15 @@ def __init__(self, api_key, api_secret, api_url='https://api.opentok.com'):
60
60
self .api_key = str (api_key )
61
61
self .api_secret = api_secret
62
62
self .api_url = api_url
63
+ self ._proxies = None
64
+
65
+ @property
66
+ def proxies (self ):
67
+ return self ._proxies
68
+
69
+ @proxies .setter
70
+ def proxies (self , proxies ):
71
+ self ._proxies = proxies
63
72
64
73
def generate_token (self , session_id , role = Roles .publisher , expire_time = None , data = None ):
65
74
"""
@@ -180,12 +189,12 @@ def create_session(self, location=None, media_mode=MediaModes.relayed, archive_m
180
189
:param String media_mode: Determines whether the session will transmit streams using the
181
190
OpenTok Media Router (MediaMode.routed) or not (MediaMode.relayed). By default,
182
191
the setting is MediaMode.relayed.
183
-
192
+
184
193
With the media_mode property set to MediaMode.relayed, the session
185
- will attempt to transmit streams directly between clients. If clients cannot connect
194
+ will attempt to transmit streams directly between clients. If clients cannot connect
186
195
due to firewall restrictions, the session uses the OpenTok TURN server to relay
187
196
audio-video streams.
188
-
197
+
189
198
The `OpenTok Media
190
199
Router <https://tokbox.com/opentok/tutorials/create-session/#media-mode>`_
191
200
provides the following benefits:
@@ -237,7 +246,7 @@ def create_session(self, location=None, media_mode=MediaModes.relayed, archive_m
237
246
options [u ('location' )] = location
238
247
239
248
try :
240
- response = requests .post (self .session_url (), data = options , headers = self .headers ())
249
+ response = requests .post (self .session_url (), data = options , headers = self .headers (), proxies = self . proxies )
241
250
response .encoding = 'utf-8'
242
251
243
252
if response .status_code == 403 :
@@ -325,7 +334,7 @@ def start_archive(self, session_id, has_audio=True, has_video=True, name=None, o
325
334
'outputMode' : output_mode .value
326
335
}
327
336
328
- response = requests .post (self .archive_url (), data = json .dumps (payload ), headers = self .archive_headers ())
337
+ response = requests .post (self .archive_url (), data = json .dumps (payload ), headers = self .archive_headers (), proxies = self . proxies )
329
338
330
339
if response .status_code < 300 :
331
340
return Archive (self , response .json ())
@@ -351,7 +360,7 @@ def stop_archive(self, archive_id):
351
360
352
361
:rtype: The Archive object corresponding to the archive being stopped.
353
362
"""
354
- response = requests .post (self .archive_url (archive_id ) + '/stop' , headers = self .archive_headers ())
363
+ response = requests .post (self .archive_url (archive_id ) + '/stop' , headers = self .archive_headers (), proxies = self . proxies )
355
364
356
365
if response .status_code < 300 :
357
366
return Archive (self , response .json ())
@@ -374,7 +383,7 @@ def delete_archive(self, archive_id):
374
383
375
384
:param String archive_id: The archive ID of the archive to be deleted.
376
385
"""
377
- response = requests .delete (self .archive_url (archive_id ), headers = self .archive_headers ())
386
+ response = requests .delete (self .archive_url (archive_id ), headers = self .archive_headers (), proxies = self . proxies )
378
387
379
388
if response .status_code < 300 :
380
389
pass
@@ -392,7 +401,7 @@ def get_archive(self, archive_id):
392
401
393
402
:rtype: The Archive object.
394
403
"""
395
- response = requests .get (self .archive_url (archive_id ), headers = self .archive_headers ())
404
+ response = requests .get (self .archive_url (archive_id ), headers = self .archive_headers (), proxies = self . proxies )
396
405
397
406
if response .status_code < 300 :
398
407
return Archive (self , response .json ())
@@ -421,7 +430,7 @@ def get_archives(self, offset=None, count=None):
421
430
if count is not None :
422
431
params ['count' ] = count
423
432
424
- response = requests .get (self .archive_url () + "?" + urlencode (params ), headers = self .archive_headers ())
433
+ response = requests .get (self .archive_url () + "?" + urlencode (params ), headers = self .archive_headers (), proxies = self . proxies )
425
434
426
435
if response .status_code < 300 :
427
436
return ArchiveList (self , response .json ())
0 commit comments