Snippets Collections
import requests

bad_links = []

def check_link(link):
    res = requests.get(link)
    if res.status_code == 200:
        print('working')
    else:
        print('not working')
        bad_links.append(link)

links = [
    'http://127.0.0.1:8000/',
    'http://127.0.0.1:8000/test1',
    'http://127.0.0.1:8000/test2'
]


for link in links:
    check_link(link)
import requests
from tqdm import tqdm

url = 'https://player.vimeo.com/external/121142413.sd.mp4?s=1b8ed80f9ce01d9ecf4af3eb12c879e00f29850f&profile_id=112&oauth2_token_id=57447761'

res = requests.get(url, stream = True)
total_size = int(res.headers.get('content-length', 0))
progress_bar = tqdm(total = total_size, unit = 'iB', unit_scale = True)

with open('video.mp4', 'wb') as file:
    for data in res.iter_content(1024):
        file.write(data)
        progress_bar.update(len(data))


progress_bar.close()
def every(arr, every_num):
    new_list = []
    for i in range(0, len(arr), every_num):
        new_list.append(arr[i: i + every_num])

    return new_list


mylist = [1, 2, 3, 4, 5, 6, 7, 8, 9]
result = every(mylist, 4)
print(result)
star

Wed Nov 29 2023 15:30:22 GMT+0000 (Coordinated Universal Time) https://dev.to/amr2018/a-simple-python-script-to-check-for-broken-links-1b35

##python #coding
star

Wed Nov 29 2023 15:29:23 GMT+0000 (Coordinated Universal Time) https://dev.to/amr2018/how-to-create-a-progress-bar-for-downloading-files-in-python-2a8b

##python #coding #progressbar
star

Wed Nov 29 2023 13:53:44 GMT+0000 (Coordinated Universal Time)

##python #coding
star

Tue Mar 15 2022 04:13:20 GMT+0000 (Coordinated Universal Time) https://www.digitalocean.com/community/conceptual_articles/s-o-l-i-d-the-first-five-principles-of-object-oriented-design

#standards #php #coding

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension