コード例 #1
0
ファイル: SigninDialog.py プロジェクト: hao707822882/bcloud
 def update_img(self, req_data, error=None):
     if error or not req_data:
         return
     vcode_path = os.path.join(Config.get_tmp_path(self.form['username']),
                               'bcloud-signin-vcode')
     with open(vcode_path, 'wb') as fh:
         fh.write(req_data)
     self.vcode_img.set_from_file(vcode_path)
コード例 #2
0
ファイル: SigninDialog.py プロジェクト: earthGavinLee/bcloud
 def update_img(self, req_data, error=None):
     if error or not req_data:
         return
     vcode_path = os.path.join(Config.get_tmp_path(self.form['username']),
                               'bcloud-signin-vcode')
     with open(vcode_path, 'wb') as fh:
         fh.write(req_data)
     self.vcode_img.set_from_file(vcode_path)
コード例 #3
0
ファイル: Cli.py プロジェクト: zhaihj/bcloud-curses
 def load_auth(self, username):
     auth_file = os.path.join(Config.get_tmp_path(username), 'auth.json')
     if os.path.exists(auth_file):
         if time.time() - os.stat(auth_file).st_mtime < DELTA:
             with open(auth_file) as fh:
                 c, tokens = json.load(fh)
             cookie = RequestCookie(c)
             return cookie, tokens
     return None, None
コード例 #4
0
ファイル: Cli.py プロジェクト: horasal/bcloud-curses
 def load_auth(self, username):
     auth_file = os.path.join(Config.get_tmp_path(username), 'auth.json')
     if os.path.exists(auth_file):
         if time.time() - os.stat(auth_file).st_mtime < DELTA:
             with open(auth_file) as fh:
                 c, tokens = json.load(fh)
             cookie = RequestCookie(c)
             return cookie, tokens
     return None, None
コード例 #5
0
ファイル: VCodeDialog.py プロジェクト: earthGavinLee/bcloud
 def update_img(self, request, error=None):
     if error or not request:
         # TODO: add a refresh button
         return
     vcode_path = os.path.join(
             Config.get_tmp_path(self.app.profile['username']),
             'bcloud-download-vcode.jpg')
     with open(vcode_path, 'wb') as fh:
         fh.write(request.data)
     self.img.set_from_file(vcode_path)
コード例 #6
0
 def update_img(self, request, error=None):
     if error or not request:
         # TODO: add a refresh button
         return
     vcode_path = os.path.join(
         Config.get_tmp_path(self.app.profile['username']),
         'bcloud-download-vcode.jpg')
     with open(vcode_path, 'wb') as fh:
         fh.write(request.data)
     self.img.set_from_file(vcode_path)
コード例 #7
0
ファイル: SigninDialog.py プロジェクト: wupeng1988/bcloud
 def update_img(self, req_data, error=None):
     if error or not req_data:
         self.refresh_vcode()
         logger.error("SigninDialog.update_img: %s, %s" % (req_data, error))
         return
     vcode_path = os.path.join(Config.get_tmp_path(self.username), "bcloud-signin-vcode.jpg")
     with open(vcode_path, "wb") as fh:
         fh.write(req_data)
     self.vcode_img.set_from_file(vcode_path)
     self.loading_spin.stop()
     self.loading_spin.hide()
     self.vcode_entry.set_sensitive(True)
コード例 #8
0
 def update_img(self, req_data, error=None):
     if error or not req_data:
         self.refresh_vcode()
         logger.error('SigninDialog.update_img: %s, %s' % (req_data, error))
         return
     vcode_path = os.path.join(Config.get_tmp_path(self.username),
                               'bcloud-signin-vcode.jpg')
     with open(vcode_path, 'wb') as fh:
         fh.write(req_data)
     self.vcode_img.set_from_file(vcode_path)
     self.loading_spin.stop()
     self.loading_spin.hide()
     self.vcode_entry.set_sensitive(True)
コード例 #9
0
 def dump_auth(self, username, cookie, tokens):
     auth_file = os.path.join(Config.get_tmp_path(username), 'auth.json')
     with open(auth_file, 'w') as fh:
         json.dump([str(cookie), tokens], fh)
コード例 #10
0
ファイル: SigninDialog.py プロジェクト: anchowee/bcloud
 def dump_auth(self, username, cookie, tokens):
     auth_file = os.path.join(Config.get_tmp_path(username), 'auth.json')
     with open(auth_file, 'w') as fh:
         json.dump([str(cookie), tokens], fh)