gistapi/core.py
def save(self):
        """Upload the changes to Github."""
        params = {
            '_method': 'put',
            'login': self._username or USERNAME,
            'token': self._token or TOKEN,
        }
        names_map = self._renames
        original_names = names_map.values()
        index = len(original_names)
        for fn, content in self.files.items():
            ext = os.path.splitext(fn)[1] or '.txt'
            try:
                orig = names_map.pop(fn)
            except KeyError:
                # Find a unique filename
                while True:
                    orig = 'gistfile%s' % index
                    index += 1
                    if orig not in original_names:
                        break
            params.update({
                'file_name[%s]' % orig: fn,
                'file_ext[%s]' % orig: ext,
                'file_contents[%s]' % orig: content,
            })
        code, msg = self._post(params=params)
        if code == 200:  # OK
            # If successful, clear the cache
            self.reset()
        return code, msg
Upload the changes to Github.
Upload the changes to Github.
Upload the changes to Github .
def save(self):
        params = {
            '_method': 'put',
            'login': self._username or USERNAME,
            'token': self._token or TOKEN,
        }
        names_map = self._renames
        original_names = names_map.values()
        index = len(original_names)
        for fn, content in self.files.items():
            ext = os.path.splitext(fn)[1] or '.txt'
            try:
                orig = names_map.pop(fn)
            except KeyError:
                while True:
                    orig = 'gistfile%s' % index
                    index += 1
                    if orig not in original_names:
                        break
            params.update({
                'file_name[%s]' % orig: fn,
                'file_ext[%s]' % orig: ext,
                'file_contents[%s]' % orig: content,
            })
        code, msg = self._post(params=params)
        if code == 200:  
            self.reset()
        return code, msg
def save ( self ) : params = { '_method' : 'put' , 'login' : self . _username or USERNAME , 'token' : self . _token or TOKEN , } names_map = self . _renames original_names = names_map . values ( ) index = len ( original_names ) for fn , content in self . files . items ( ) : ext = os . path . splitext ( fn ) [ 1 ] or '.txt' try : orig = names_map . pop ( fn ) except KeyError : while True : orig = 'gistfile%s' % index index += 1 if orig not in original_names : break params . update ( { 'file_name[%s]' % orig : fn , 'file_ext[%s]' % orig : ext , 'file_contents[%s]' % orig : content , } ) code , msg = self . _post ( params = params ) if code == 200 : self . reset ( ) return code , msg
Upload the changes to Github.
Upload the changes to Github .
"""Upload the changes to Github.""" # Find a unique filename # OK # If successful, clear the cache
self