def upload_gist(self, commands): username = self.conf['github'].get('username') api_key = self.conf['github'].get('api_key') public = self.conf['github'].get('public', True) gist = Gist(username = username, api_key = api_key, public = public) gist.description = self.title for filename in self.files: path = os.path.join(self.bugdir, filename) with open(path) as f: content = f.read() gist.add_file(filename, content) for (filename, content) in commands.items(): gist.add_file(filename, content) return gist.create()