hilite.me icon indicating copy to clipboard operation
hilite.me copied to clipboard

API does not use divstyles when using GET/POST method

Open appblue opened this issue 10 years ago • 1 comments

I've looked at the code and in my opinion the problem lies in main.py in line no 85:

divstyles = request.form.get('divstyles', get_default_style())

it should be

divstyles = request.values.get('divstyles', get_default_style())

On webpage it works, because you use also value for divstyles stored in cookie, but it's not the case when using API

Best Regards, Chris

appblue avatar Aug 29 '14 13:08 appblue

I am experiencing the same issue. Bump.

Workaround (Python3 requests):

import requests

r = requests.post('http://hilite.me/api', data={'code':'echo "This is basically just a form', 'lexer':'bash', 'divstyles':'padding:.2em .6em;'})

print(r.content.decode())

NuclearManD avatar Jan 13 '21 15:01 NuclearManD