import base64
import requests
import json


def test_post_image(img_file, URL):
    """ post image and return the response """
    with open(img_file, 'rb') as f:
        img = base64.b64encode(f.read()).decode()
    response = requests.post(URL, data={"image": img})
    return json.loads(response.content.decode('utf-8'))