Commit 14ca843c5bb32b7a0e789237c7f42f50dbc8dd6f
- Diff rendering mode:
- inline
- side by side
swtr/server.py
(9 / 0)
  | |||
220 | 220 | style.set("type", "text/css") | |
221 | 221 | ||
222 | 222 | ||
223 | @app.route('/getMediaType') | ||
224 | def getMediaType(): | ||
225 | request = requests.get(flask.request.args['where']) | ||
226 | content = request.text | ||
227 | if imghdr.what('ignore', content) is None: | ||
228 | return flask.jsonify({'type': 'html'}) | ||
229 | else: | ||
230 | return flask.jsonify({'type': 'image'}) | ||
231 | |||
223 | 232 | # if the app is run directly from command-line | |
224 | 233 | # assume its being run locally in a dev environment | |
225 | 234 | if __name__ == '__main__': |