Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _download_video(self, video_url, video_name):
"""Download a video from the remote node
:param video_url: video url
:param video_name: video name
"""
from toolium.driver_wrappers_pool import DriverWrappersPool
filename = '{0:0=2d}_{1}'.format(DriverWrappersPool.videos_number, video_name)
filename = '{}.mp4'.format(get_valid_filename(filename))
filepath = os.path.join(DriverWrappersPool.videos_directory, filename)
makedirs_safe(DriverWrappersPool.videos_directory)
response = requests.get(video_url)
open(filepath, 'wb').write(response.content)
self.logger.info("Video saved in '%s'", filepath)
DriverWrappersPool.videos_number += 1
def _download_video(self, video_url, video_name):
"""Download a video from the remote node
:param video_url: video url
:param video_name: video name
"""
from toolium.driver_wrappers_pool import DriverWrappersPool
filename = '{0:0=2d}_{1}'.format(DriverWrappersPool.videos_number, video_name)
filename = '{}.mp4'.format(get_valid_filename(filename))
filepath = os.path.join(DriverWrappersPool.videos_directory, filename)
makedirs_safe(DriverWrappersPool.videos_directory)
response = requests.get(video_url)
open(filepath, 'wb').write(response.content)
self.logger.info("Video saved in '%s'", filepath)
DriverWrappersPool.videos_number += 1
def __init__(self, driver_wrapper, **kwargs):
"""
get data from properties file and session
:param driver_wrapper: driver_wrapper instance from toolium
dynamic parameters:
:param videos_dir: videos directory to download
:param logs_dir: logs directory to download
:param output_dir: general directory to download
"""
self.driver_wrapper = driver_wrapper
from toolium.driver_wrappers_pool import DriverWrappersPool
self.videos_directory = kwargs.get('videos_dir', DriverWrappersPool.videos_directory)
self.logs_directory = kwargs.get('logs_dir', DriverWrappersPool.logs_directory)
self.output_directory = kwargs.get('output_dir', DriverWrappersPool.output_directory)
self.browser_remote = driver_wrapper.config.getboolean_optional('Server', 'enabled', False)
self.browser = driver_wrapper.driver.desired_capabilities['browserName']
if self.browser_remote:
self.session_id = driver_wrapper.driver.session_id
self.server_url = driver_wrapper.utils.get_server_url()