Example #1
0
    def get(self, number):
        '''Handles chat portion of the puzzle page.'''
        if not self.logged_in:
            self.login_needed()
            return

        http = oauth_decorator.http()
        data = oauth2_service.userinfo().get().execute(http=http)
        nick = data['given_name'] + data['family_name']

        if number == '0':
            channels = 'galactic-trendsetters verytrendy!'
        else:
            channels = 'galactic-trendsetters-%s verytrendy!' % (number,)

        chat_args = [
            ('channels', channels),
            ('nick', nick),
        ]
        # qwebirc requires quote, not quote_plus
        # http://hg.qwebirc.org/qwebirc/issue/323
        chat_frame = '//webchat.freenode.net/?' + \
            '&'.join(urllib.quote(k) + '=' + urllib.quote(v)
                     for k, v in chat_args)

        context = {
            'chat_frame': chat_frame,
        }
        self.render('chat.html', context)
Example #2
0
    def createEmptySpreadsheet(self, number):
        resp, content = httplib2.Http().request('http://galdoge.kaseorg.com/cgi-bin/suchbot-new-channel.cgi?' + urllib.urlencode({'id': number}))
        assert resp.status == 200

        http = oauth_decorator.http()
        body = {
            'title': '2015.'+number,
            'mimeType': 'application/vnd.google-apps.spreadsheet',
            'parents': [{'id': HUNT_2015_FOLDER_ID}]
        }
        file = drive_service.files().insert(body=body).execute(http=http)
        return (file['id'], file['alternateLink'])
Example #3
0
 def trashFile(self, file_id):
     http = oauth_decorator.http()
     drive_service.files().trash(fileId=file_id).execute(http=http)