This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
OlderNewer