Skip to content

Instantly share code, notes, and snippets.

@dinoocch
Created November 15, 2016 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dinoocch/8d13401ad5745d1aaf51167b19394920 to your computer and use it in GitHub Desktop.
Save dinoocch/8d13401ad5745d1aaf51167b19394920 to your computer and use it in GitHub Desktop.
body = """--{boundary}
Content-Type: application/json; charset=UTF-8
Content Disposition: attachment; name="metadata"
{{"message": "{message}"}}
--{boundary}
Content-Type: img/png
Content-Disposition: attachment; name="file"; filename="grafana.png"
Content-Transfer-Encoding: base64
{image}
--{boundary}
""".format(message="test", boundary=binascii.b2a_hex(os.urandom(15)), image="BASE64ENCODEDIMAGE")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment