Skip to content

Instantly share code, notes, and snippets.

View 24Ryou's full-sized avatar
🪐
always learning....

ali 24Ryou

🪐
always learning....
View GitHub Profile
@24Ryou
24Ryou / randomPhoto.py
Last active November 11, 2022 18:26
source.unsplash get random photo
import requests
from pathlib import Path
# Download an image off unsplash without the api using python
def downloadimages(search_term, resolution, amount): # Define the function to download images
print(f"https://source.unsplash.com/random/{resolution}/?"+str(search_term)+", allow_redirects=True") # State the URL
path = Path('YourLocalPathForSaveFile')
# Loop for chosen amount of times
for x in range(int(amount)):
@24Ryou
24Ryou / shortenURL.py
Last active November 11, 2022 18:24
make url shorten
import requests
from decouple import config
import urllib
def shortURL(URL):
key = config('CUTTLY_TOKEN')
parsedURL = urllib.parse.quote(URL)
r = requests.get('http://cutt.ly/api/api.php?key={}&short={}'.format(key, parsedURL))
data = r.json()