Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

web.py server which allow cross-site xmlhttprequest

View cross-site-xmlhttprequest.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
import web
 
urls = (
'/(.*)', 'Service'
)
app = web.application(urls, globals())
 
class Service:
def GET(self, name):
web.header('Access-Control-Allow-Origin', '*')
web.header('Access-Control-Allow-Credentials', 'true')
return {'message': GET OK!'}
def POST(self, name):
web.header('Access-Control-Allow-Origin', '*')
web.header('Access-Control-Allow-Credentials', 'true')
data = web.data()
return {'message': "POST OK! %s" % data}
 
if __name__ == "__main__":
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.