Last active
March 2, 2017 14:30
-
-
Save snobu/6121757ab571218fe71534fa4bc1ac37 to your computer and use it in GitHub Desktop.
temp-gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import absolute_import, unicode_literals | |
| import sys, os, cStringIO, urllib, base64 | |
| import json | |
| # Add function directory to import path | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname( __file__ )))) | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname( __file__ ), 'lib'))) | |
| from AzureHTTPHelper import HTTPHelper | |
| http = HTTPHelper() | |
| output_path = os.path.join(workingdir, 'output.jpg') | |
| jpegfile = open(output_path, mode='rb') # b = binary | |
| rawjpegbytes = jpegfile.read() | |
| # ascii response body | |
| returnData = { | |
| #HTTP Status Code: | |
| "status": 200, | |
| #Response Body: | |
| "body": "SOME TEXT", | |
| # Send any number of HTTP headers | |
| "headers": { | |
| "Content-Type": "image/jpeg" | |
| } | |
| } | |
| # Output the response to the client | |
| output = open(os.environ['res'], 'w') | |
| # binary response body | |
| output.write(rawjpegbytes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment