so i made a python program that at some point posts an image to imgur, and it completely works on my local pc. but when i tried putting it on a cloud hosting service (Digital Ocean) and running it via there, it just returns a 403 saying "Imgur is temporarily over capacity. Please try again later."
the code:
rand = random.randint(1, requests.get("https://pokeapi.co/api/v2/pokemon-species").json()["count"])
poke = requests.get(f"https://pokeapi.co/api/v2/pokemon/{rand}").json()
pokeimage = poke["sprites"]["other"]["official-artwork"]["front_default"]
og_pokeimage = pokeimage
file = None
if hard != None:
trueimage = requests.get(pokeimage).content
# Open image and make into Numpy array
na = np.array(Image.open(io.BytesIO(trueimage)))
# Make every pixel, of every row of every column black in RGB channels, i.e. channel 0, 1, 2
na[:, :, :3] = 0
# Make Boolean True/False mask of all alphas > 200
mask = na[:,:,3] > 200
# Set alpha channel to 255 wherever mask is True, and 0 elsewhere
na[:, :, 3] = mask * 255
# Convert back from Numpy array to PIL Image
pokepil = Image.fromarray(na)
image_buffer = io.BytesIO()
pokepil.save(image_buffer, format="PNG")
encoded_image = base64.b64encode(image_buffer.getvalue()).decode("utf-8")
# Upload the Base64-encoded image to Imgur
imgur_response = requests.post(
"https://api.imgur.com/3/image",
headers={"Authorization": f"Client-ID {self.imgclient}"},
data={"image": encoded_image}
)
imgur_data = imgur_response.json()
await ctx.channel.send(imgur_data)
# Retrieve the Imgur URL of the uploaded image
pokeimage=imgur_data["data"]["link"]
I hope someone knows how to fix it!