image_content = requests.get(image_url).content
image = Image.open(BytesIO(image_content))
image = image.crop((0, 0, image.size[0], image.size[0]*0.975))
image_content = BytesIO()
image.save(image_content, format='JPEG')
requests.post(url, files={'photo': ('upload.jpg', image_content)})
image_content = BytesIO()
image.save(image_content, format='JPEG')
from PIL import Image
import requests
from io import BytesIO
response = requests.get(url)
img = Image.open(BytesIO(response.content))
with open(filename, 'rb') as f:
r = requests.post(url, data=f.read())
image_content = requests.get(image_url).content
image = Image.open(BytesIO(image_content))
image = image.crop((0, 0, image.size[0], image.size[0]*0.975))
image_content = BytesIO()
image.seek(0)
image.save(image_content, format='JPEG')
image_content.seek(0)
requests.post(url, files={'photo': ('upload.jpg', image_content)})