title: can't send/request base64 to azure face api with python
body: <p>I want to send the image up on azure face api but it is straightforward to convert the image file to base64 and cannot send requests.</p>
  
  <p>this is code request azure face api,running python but code show error</p>
  
  <pre class="lang-py prettyprint-override"><code>import requests
  import json
  import base64
  
  subscription_key = 'my_key'
  assert subscription_key
  
  face_api_url = 'https://southeastasia.api.cognitive.microsoft.com/face/v1.0/detect'
  
  
  headers = { 'Ocp-Apim-Subscription-Key': subscription_key }
  
  #data = 'test.jpg'
  
  with open("test.jpg", "rb") as image_file:
      encoded_string = base64.b64encode(image_file.read())
      print(encoded_string)
  
  params = {
      'returnFaceId': 'true',
      'returnFaceLandmarks': 'false',
      'returnFaceAttributes': 'age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise',
  }
  
  #body={
  #    "url": 'data:image/jpeg;base64' + str(encoded_string)
  #}
  #data={
  #    "data": encoded_string,
  #    "contentType": "application/octet-stream",
  #}
  
  response = requests.post(face_api_url, params=params, headers=headers, json={"data": "image/JPEG;base64,/"+str(encoded_string)})
  print(json.dumps(response.json()))
  </code></pre>
  
  <p>this is error:</p>
  
  <pre><code>{"error": {"code": "InvalidURL", "message": "Invalid image URL."}}
  </code></pre>
  
  <p>this is correct:</p>
  
  <pre><code>[{"faceId": "f9fd11a4-8855-4304-af98-f200afcae843", "faceRectangle": {"top": 621, "left": 616, "width": 195, "height": 195}, "faceAttributes": {"smile": 0.0, "headPose": {"pitch": -11.4, "roll": 7.7, "yaw": 5.3}, "gender": "male", "age": 29.0, "facialHair": {"moustache": 0.4, "beard": 0.4, "sideburns": 0.1}, "glasses": "NoGlasses", "emotion": {"anger": 0.0, "contempt": 0.0, "disgust": 0.0, "fear": 0.0, "happiness": 0.0, "neutral": 0.999, "sadness": 0.001, "surprise": 0.0}, "blur": {"blurLevel": "high", "value": 0.89}, "exposure": {"exposureLevel": "goodExposure", "value": 0.51}, "noise": {"noiseLevel": "medium", "value": 0.59}, "makeup": {"eyeMakeup": true, "lipMakeup": false}, "accessories": [], "occlusion": {"foreheadOccluded": false, "eyeOccluded": false, "mouthOccluded": false}, "hair": {"bald": 0.04, "invisible": false, "hairColor": [{"color": "black", "confidence": 0.98}, {"color": "brown", "confidence": 0.87}, {"color": "gray", "confidence": 0.85}, {"color": "other", "confidence": 0.25}, {"color": "blond", "confidence": 0.07}, {"color": "red", "confidence": 0.02}]}}}, {"faceId": "6c83b2c8-2cdc-43ea-994c-840932601b1d", "faceRectangle": {"top": 693, "left": 1503, "width": 180, "height": 180}, "faceAttributes": {"smile": 0.003, "headPose": {"pitch": -9.0, "roll": -0.5, "yaw": -1.5}, "gender": "female", "age": 58.0, "facialHair": {"moustache": 0.0, "beard": 0.0, "sideburns": 0.0}, "glasses": "NoGlasses", "emotion": {"anger": 0.0, "contempt": 0.001, "disgust": 0.0, "fear": 0.0, "happiness": 0.003, "neutral": 0.984, "sadness": 0.011, "surprise": 0.0}, "blur": {"blurLevel": "high", "value": 0.83}, "exposure": {"exposureLevel": "goodExposure", "value": 0.41}, "noise": {"noiseLevel": "high", "value": 0.76}, "makeup": {"eyeMakeup": false, "lipMakeup": false}, "accessories": [], "occlusion": {"foreheadOccluded": false, "eyeOccluded": false, "mouthOccluded": false}, "hair": {"bald": 0.06, "invisible": false, "hairColor": [{"color": "black", "confidence": 0.99}, {"color": "gray", "confidence": 0.89}, {"color": "other", "confidence": 0.64}, {"color": "brown", "confidence": 0.34}, {"color": "blond", "confidence": 0.07}, {"color": "red", "confidence": 0.03}]}}}]
  </code></pre>