Skip to content

Instantly share code, notes, and snippets.

@victoroliv2
Created October 7, 2011 19:09

Revisions

  1. victoroliv2 renamed this gist Oct 7, 2011. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. victoroliv2 created this gist Oct 7, 2011.
    20 changes: 20 additions & 0 deletions cross-site-xmlhttprequest
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,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()