
Every Developer Should Have a 'Scripts' Folder — Here's What's in Mine
The Most Productive Thing I Ever Did Two years ago, I created a ~/scripts/ folder. Every time I write a one-off script that saves me time, it goes in there. Now I have 30+ scripts that save me hours every week. Here are the most useful ones. 1. Quick API Check #!/usr/bin/env python3 # api_check.py — Test if an API endpoint is alive import requests , sys url = sys . argv [ 1 ] if len ( sys . argv ) > 1 else input ( " URL: " ) try : resp = requests . get ( url , timeout = 10 ) print ( f " Status: { resp . status_code } " ) print ( f " Time: { resp . elapsed . total_seconds () : . 2 f } s " ) print ( f " Size: { len ( resp . content ) } bytes " ) if resp . headers . get ( " content-type " , "" ). startswith ( " application/json " ): import json print ( json . dumps ( resp . json (), indent = 2 )[: 500 ]) except Exception as e : print ( f " Error: { e } " ) Usage: python3 api_check.py https://api.openalex.org/works?per_page=1 2. CSV Quick Look #!/usr/bin/env python3 # csv_look.py — Quick s
Continue reading on Dev.to Python
Opens in a new tab




