Skip to content

Commit 7037cbd

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c6b198f commit 7037cbd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scripts/bulkdownloadfromurls.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ def read_urls_from_csv(csv_file, column_name):
77
try:
88
# Read CSV file into a DataFrame
99
image_data = pd.read_csv(csv_file)
10-
10+
1111
# Extract URLs from specified column
1212
urls = image_data[column_name].tolist()
13-
13+
1414
return urls
1515
except FileNotFoundError as e:
1616
print(f"File not found: {e}")
@@ -24,19 +24,19 @@ def download_image(url, folder):
2424
# Send a GET request to the URL with a timeout
2525
response = requests.get(url, stream=True, timeout=10)
2626
response.raise_for_status()
27-
27+
2828
# Generate a unique filename using the URL
2929
filename = quote_plus(url)[:25] # Limit filename length
3030
filename = f"{filename}.jpg"
31-
31+
3232
# Create the output path
3333
output_path = os.path.join(folder, filename)
34-
34+
3535
# Save the image to the specified folder
3636
with open(output_path, 'wb') as file:
3737
for chunk in response.iter_content(8192):
3838
file.write(chunk)
39-
39+
4040
print(f"Downloaded: {url} to {output_path}")
4141
except requests.exceptions.RequestException as e:
4242
print(f"Failed to download {url}: {e}")

0 commit comments

Comments
 (0)