In this blog we will give an example how to load image from url in odoo using http controller function
so let us say that we made an integration with external api to get new customer data with is include image_url field and we want to save this image into odoo database , so first we must create function that takes the image_url as an input and return the image as data , second we can pass the image data to image field in res.partner object in odoo to create new customer with image , and the function can be just as bellow
def load_image_from_url(self, url):
data = base64.b64encode(requests.get(url.strip()).content).replace(b'\n', b'')
return data