From: Can Duruk Date: Fri, 30 Sep 2011 00:39:57 +0000 (-0700) Subject: Add a RawParser to access JSON objects directly X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a798c6f9ab3538ab759ef89cd6b411c7a47d2568;p=tweepy.git Add a RawParser to access JSON objects directly --- diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a1a5b28..1232cbc 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -24,3 +24,4 @@ Thomas Bohmbach, Jr Wayne Moore Will McCutchen gilles +Can Duruk diff --git a/tweepy/api.py b/tweepy/api.py index 3ca294f..876d0ec 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -7,7 +7,7 @@ import mimetypes from tweepy.binder import bind_api from tweepy.error import TweepError -from tweepy.parsers import ModelParser +from tweepy.parsers import ModelParser, RawParser from tweepy.utils import list_to_csv @@ -77,7 +77,7 @@ class API(object): allowed_param = ['id', 'count', 'page'], require_auth = True ) - + """/related_results/show/:id.format""" related_results = bind_api( path = '/related_results/show/{id}.json', diff --git a/tweepy/parsers.py b/tweepy/parsers.py index 1aa643e..77640ce 100644 --- a/tweepy/parsers.py +++ b/tweepy/parsers.py @@ -26,6 +26,18 @@ class Parser(object): raise NotImplementedError +class RawParser(Parser): + + def __init__(self): + pass + + def parse(self, method, payload): + return payload + + def parse_error(self, payload): + return payload + + class JSONParser(Parser): payload_format = 'json'