From 3b9c9447b86c73db1313924e2043dc928fe9da50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar?= Date: Tue, 18 May 2021 20:01:17 +0200 Subject: [PATCH] Remove requests as a dependency --- CHANGELOG.md | 1 + moviepy/video/io/downloader.py | 10 ++++------ setup.py | 1 - 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1097797d..f33a81708 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Renamed `colorx` FX by `multiply_color` [\#1475](https://github.com/Zulko/moviepy/pull/1475) - Renamed `speedx` FX by `multiply_speed` [\#1478](https://github.com/Zulko/moviepy/pull/1478) - `make_loopable` transition must be used as FX [\#1477](https://github.com/Zulko/moviepy/pull/1477) +- `requests` package is no longer a dependency [\#1566](https://github.com/Zulko/moviepy/pull/1566) ### Deprecated - `moviepy.video.fx.all` and `moviepy.audio.fx.all`. Use the fx method directly from the clip instance or import the fx function from `moviepy.video.fx` and `moviepy.audio.fx`. [\#1105](https://github.com/Zulko/moviepy/pull/1105) diff --git a/moviepy/video/io/downloader.py b/moviepy/video/io/downloader.py index 838326d60..68b14a1f4 100644 --- a/moviepy/video/io/downloader.py +++ b/moviepy/video/io/downloader.py @@ -1,8 +1,8 @@ """Utilities to get a file from the internet.""" import os - -import requests +import shutil +import urllib.request from moviepy.tools import subprocess_call @@ -18,10 +18,8 @@ def download_webfile(url, filename, overwrite=False): return if "." in url: - r = requests.get(url, stream=True) - with open(filename, "wb") as fd: - for chunk in r.iter_content(chunk_size=128): - fd.write(chunk) + with urllib.request.urlopen(url) as req, open(filename, "wb") as f: + shutil.copyfileobj(req, f, 128) else: try: diff --git a/setup.py b/setup.py index 7d9f17199..046610b2a 100644 --- a/setup.py +++ b/setup.py @@ -77,7 +77,6 @@ def run_tests(self): "imageio>=2.5,<3.0", "imageio_ffmpeg>=0.2.0", "numpy>=1.17.3,<=1.20", - "requests>=2.8.1,<3.0", "proglog<=1.0.0", ]