So i have some code that downloads an image, overlays it and shows the result. However I am getting a 403 (probably from user agent) when trying to download from a specific site. How can I create code similar to this that does the same thing?
from PIL import Image
import os, sys
import wget
import requests
url = "https://cdn.discordapp.com/avatars/247096918923149313/34a66572b9339acdaa1dedbcb63bc90a.png?size=256"
filename = wget.download(url)
pp = Image.open(filename)
pp.save("image2c.png")
pp = Image.open("image2c.png").convert("LA")
pp.save("image2c.png")
background = Image.open("image1.png").convert("RGBA")
foreground = Image.open("image2c.png").convert("RGBA")
foreground = foreground.resize((256, 256), Image.BILINEAR)
background.paste(foreground, (125, 325), foreground)
background.show()
os.remove(filename)