Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(9)  |  Derive(0)  |  Import(0)

src/b/n/bnw-HEAD/bnw/web/site.py   bnw(Download)
    def respond(self, username, thumb=''):
        self.set_header('Cache-Control', 'max-age=3600, public')
        self.set_header('Vary', 'Accept-Encoding')
        user = yield objs.User.find_one({'name': username})
        if not (user and user.get('avatar') and False):
            self.set_header('Content-Type', 'image/png')
        avatar = yield fs.get(doc)
        avatar_data = yield avatar.read()
        self.set_header('Content-Type', mimetype)
        defer.returnValue(avatar_data)
 
class SitemapHandler(BnwWebHandler):
    @defer.inlineCallbacks
    def respond(self, type_):
        self.set_header('Cache-Control', 'public')

src/b/n/bnw-HEAD/bnw/web/api.py   bnw(Download)
    def respond_post(self, cmd_name):
        stime = time.time()
        user = yield objs.User.find_one(
            {'login_key': self.get_argument('login', '')})
        self.set_header('Content-Type', 'application/json; charset=utf-8')
        if 'login' in args:
            del args['login']
        self.set_header('Cache-Control', 'no-cache')
        cors_origin = self.request.headers.get('Origin', None)
        if cors_origin:
            self.set_header('Access-Control-Allow-Origin', '*')