From a798c6f9ab3538ab759ef89cd6b411c7a47d2568 Mon Sep 17 00:00:00 2001 From: Can Duruk Date: Thu, 29 Sep 2011 17:39:57 -0700 Subject: [PATCH] Add a RawParser to access JSON objects directly --- CONTRIBUTORS | 1 + tweepy/api.py | 4 ++-- tweepy/parsers.py | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) 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' -- 2.25.1