This repository documents my journey in learning how to interact with web APIs using Python. As practical examples, I’m exploring the GitHub API, working with file downloads, checking my IP address, and practicing file handling.
GitHubAPI.py: My main Python script for experimenting with API requests, parsing JSON, and handling errors using the GitHub API.downloadingFiles.py: Demonstrates how to download files from a URL with progress tracking and error handling.knowYourIP.py: Simple script to fetch and display your public IP address using the ipify API.fileHandling.py: Practice file operations in Python, including reading, writing, appending, and searching for words in files.
Install the required packages:
pip install requests tqdm-
GitHub API:
Set theusernamevariable inGitHubAPI.pyto the GitHub profile you want to explore, then run:python GitHubAPI.py
-
Download Files:
RundownloadingFiles.py, paste a direct download URL when prompted, and the file will be saved asvideo.mp4with a progress bar:python downloadingFiles.py
-
Know Your IP:
RunknowYourIP.pyto display your public IP address:python knowYourIP.py
-
File Handling Practice:
Explore various file operations infileHandling.pyby uncommenting and running different code blocks.
- Sending GET and POST requests to REST APIs using Python
- Parsing JSON responses from APIs
- Handling errors and displaying useful messages
- Downloading files with progress indication and robust error handling
- Reading, writing, and searching within files
get_user_info(username): Fetches and prints basic info about a GitHub user (name, bio, repo count, followers, following).get_repos(username): Lists all public repositories for the user.- Both functions handle errors gracefully and print helpful messages if something goes wrong.
- Prompts for a file URL, downloads the file with a progress bar, and handles errors professionally.
- Fetches and prints your public IP address in JSON format.
- Contains examples for writing, reading, appending, and searching text in files.
User Information for billy:
Name: Billy
Bio: Python Developer
Public Repos: 10
Followers: 50
Following: 5
Repositories for user billy:
Total repositories: 10
- repo1
- repo2
...
- Applying these in my upcoming project.
- Experiment with other APIs and file operations to build my Python skills.
Thanks for checking out my API and file handling learning project!