Commit 2d95dcfe authored by Aaron Hill's avatar Aaron Hill
Browse files

Merge branch 'foutoucour-master'

parents fad037bc 90ca6e63
......@@ -5,7 +5,8 @@ import os
from nose import SkipTest
from tweepy import Friendship, MemoryCache, FileCache
from tweepy import Friendship, MemoryCache, FileCache, API
from tweepy.parsers import Parser
from config import TweepyTestCase, username, use_replay
test_tweet_id = '266367358078169089'
......@@ -33,6 +34,9 @@ class TweepyAPITests(TweepyTestCase):
data = self.api.get_oembed(test_tweet_id)
self.assertEqual(data['author_name'], "Twitter")
def testparserargumenthastobeaparserinstance(self):
""" Testing the issue https://github.com/tweepy/tweepy/issues/421"""
self.assertRaises(TypeError, API, self.auth, parser=Parser)
def testhometimeline(self):
self.api.home_timeline()
......
......@@ -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, Parser
from tweepy.utils import list_to_csv
......@@ -38,6 +38,17 @@ class API(object):
if proxy:
self.proxy['https'] = proxy
# Attempt to explain more clearly the parser argument requirements
# https://github.com/tweepy/tweepy/issues/421
#
parser_type = Parser
if not isinstance(self.parser, parser_type):
raise TypeError(
'"parser" argument has to be an instance of "{}". It is currently a {}.'.format(
parser_type.__name__, type(self.parser)
)
)
""" statuses/home_timeline """
home_timeline = bind_api(
path = '/statuses/home_timeline.json',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment