import requests _url = "http://127.0.0.1:8000/test2/" files = { "image": ("e.jpg", open(r"C:UserswuhaoDesktope.jpg", 'rb'), "image/jpeg"), } data = { "site_id": "2132" } requests.post(url=_url, files=files, data=data)