From 98203ad8db4d24bde72ded6cd0e3b715705cdd9e Mon Sep 17 00:00:00 2001 From: HalimahH-BBC Date: Mon, 2 Mar 2026 15:04:37 +0000 Subject: [PATCH] Fix python version for examples --- examples/Makefile | 2 +- examples/ingest_hls.py | 2 +- examples/outgest_file.py | 6 +++--- examples/simple_edit.py | 4 ++-- examples/utils/credentials.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/Makefile b/examples/Makefile index 50be387d..3381d34c 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -2,7 +2,7 @@ all: help venv: mkdir -p venv - python -m venv venv + python3 -m venv venv . venv/bin/activate && pip install -r requirements.txt && deactivate sample_content: diff --git a/examples/ingest_hls.py b/examples/ingest_hls.py index 3e7202a1..12306ce7 100755 --- a/examples/ingest_hls.py +++ b/examples/ingest_hls.py @@ -201,7 +201,7 @@ async def hls_ingest( flow_params: Optional[dict] ) -> None: """Upload segments from the HLS playlist""" - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession(trust_env=True) as session: await put_flow(session, credentials, tams_url, flow_id, source_id, flow_params) object_urls = get_media_storage_urls(session, credentials, tams_url, flow_id, hls_segment_count) diff --git a/examples/outgest_file.py b/examples/outgest_file.py index 52acf3cd..c5e131f7 100755 --- a/examples/outgest_file.py +++ b/examples/outgest_file.py @@ -25,7 +25,7 @@ async def get_flow(tams_url: str, credentials: Credentials, flow_id: UUID) -> dict: """Returns a Flow dict for the given Flow ID""" flow_url = f"{tams_url}/flows/{flow_id}" - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession(trust_env=True) as session: async with get_request(session, credentials, flow_url) as resp: resp.raise_for_status() return await resp.json() @@ -39,7 +39,7 @@ async def get_flow_segments( ) -> AsyncGenerator[dict, None]: """Generator of Flow Segment dicts for the given Flow ID and timerange""" segments_url = f"{tams_url}/flows/{flow['id']}/segments?timerange={timerange!s}&presigned=true" - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession(trust_env=True) as session: while True: async with get_request(session, credentials, segments_url) as resp: resp.raise_for_status() @@ -253,7 +253,7 @@ async def outgest_file( output_timerange = TimeRange.never() with av.open(output_filename, mode="w", format="mpegts") as av_output: - async with aiohttp.ClientSession() as media_object_session: + async with aiohttp.ClientSession(trust_env=True) as media_object_session: async for segment in get_flow_segments(tams_url, credentials, flow, timerange): try: download_url = segment["get_urls"][0]["url"] diff --git a/examples/simple_edit.py b/examples/simple_edit.py index 37615989..c9a2ea80 100755 --- a/examples/simple_edit.py +++ b/examples/simple_edit.py @@ -108,7 +108,7 @@ async def simple_edit( output_source_id: UUID, ) -> None: """Add timerange of segments from input 1 followed by a timerange of segments from input 2""" - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession(trust_env=True) as session: await put_flow(session, credentials, tams_url, output_flow_id, output_source_id) # Add segments from input 1 to output @@ -200,7 +200,7 @@ async def interval_edit( "_copy_edit_interval": cut_interval_ts.to_sec_nsec() } - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession(trust_env=True) as session: # Create output Flow await put_flow(session, credentials, tams_url, output_flow_id, output_source_id, custom_tags=custom_tags) diff --git a/examples/utils/credentials.py b/examples/utils/credentials.py index bcc2bf74..9006c71f 100644 --- a/examples/utils/credentials.py +++ b/examples/utils/credentials.py @@ -70,7 +70,7 @@ async def renew_credentials(self) -> None: } headers = get_basic_auth_header(self.client_id, self.client_secret) - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession(trust_env=True) as session: async with session.post(self.authorization_url, data=form_data, headers=headers) as resp: resp.raise_for_status()