def get_content(self, r):
        """Abstraction for grabbing content from a returned response"""
        if self.type == 'exp_file':
            # don't use the decoded r.text
            return r.content
        elif self.type == 'version':
            return r.content
        else:
            if self.fmt == 'json':
                content = {}
                # Decode
                try:
                    # Watch out for bad/empty json
                    content = json.loads(r.text, strict=False)
                except ValueError as e:
                    if not self.expect_empty_json():
                        # reraise for requests that shouldn't send empty json
                        raise ValueError(e)
                finally:
                    return content
            else:
                return r.text
def get_content ( self , r ) : if self . type == 'exp_file' : return r . content elif self . type == 'version' : return r . content else : if self . fmt == 'json' : content = { } try : content = json . loads ( r . text , strict = False ) except ValueError as e : if not self . expect_empty_json ( ) : raise ValueError ( e ) finally : return content else : return r . text
Abstraction for grabbing content from a returned response