Skip to content

Commit 6183bf8

Browse files
committed
Merge branch 'low_battery_scripy' of https://github.com/gulshanjakhon/Amazing-Python-Scripts into low_battery_scripy
2 parents 9a492f5 + 5e9b9dd commit 6183bf8

File tree

29 files changed

+66
-1
lines changed

29 files changed

+66
-1
lines changed
-3.76 KB
Loading

Drowsiness-Detector/image.jpg

-8.45 KB
Loading

File Downloader Script/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# File Downloader Script
2+
3+
4+
A file downloader script is a program or script that automates the process of downloading files from a given URL. It enables users to retrieve files from the internet without manual intervention.
5+
6+
File downloader scripts typically use the HTTP or FTP protocols to establish a connection with a server hosting the desired file. They send a request to the server and retrieve the file's content, which is then saved to a local destination on the user's machine.
7+
8+
<br>
9+
10+
## Instructions 📝
11+
12+
### Step 1:
13+
14+
Save the Script: Save the script code provided earlier in a file with the desired name, such as file_downloader.py. Make sure to save it with the .py extension, indicating that it is a Python script.
15+
16+
### Step 2:
17+
18+
Install Dependencies: Ensure that you have the necessary dependencies installed. In this case, the script relies on the requests library. You can install it using the pip package manager. Open a command prompt or terminal and run the following command:
19+
20+
pip install requests
21+
22+
### Step 3:
23+
24+
Customize the Script (Optional): Depending on your specific requirements, you can customize the script. For example, you can modify the file_url variable to point to the URL of the file you want to download, and set the save_as variable to specify the destination path and filename.
25+
26+
### Step 4:
27+
28+
Run the Script: Open a command prompt or terminal, navigate to the directory where the script is saved, and run the following command:
29+
30+
python file_downloader.py
31+
32+
### Step 5:
33+
34+
Check the Output: The script will attempt to download the file from the specified URL and save it to the destination path. You will see either a success message or a failure message displayed in the command prompt or terminal, depending on the outcome of the download operation.
35+
36+
37+
### Step 6:
38+
39+
Verify the Downloaded File: After running the script, check the destination path specified in the save_as variable. If the download was successful, you should find the downloaded file at that location.
40+
41+
<br>
42+
43+
<hr>
44+
45+
> **Warning**
46+
>
47+
>Remember to update the file_url and save_as variables in the script to reflect your desired file URL and destination path before running the script.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import requests
2+
3+
def download_file(url, destination):
4+
response = requests.get(url, stream=True)
5+
if response.status_code == 200:
6+
with open(destination, 'wb') as file:
7+
for chunk in response.iter_content(chunk_size=1024):
8+
file.write(chunk)
9+
print("File downloaded successfully.")
10+
else:
11+
print("Failed to download file.")
12+
13+
# Example usage: Download a file from a URL
14+
file_url = 'https://example.com/path/to/file.txt'
15+
save_as = 'downloaded_file.txt'
16+
download_file(file_url, save_as)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests
-946 Bytes
Loading
-26 Bytes
Loading
-3 Bytes
Loading
-14 Bytes
Loading

Flappy-Bird-Game/screenshot.gif

-59.6 KB
Loading

0 commit comments

Comments
 (0)