Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/foutoucour/tweepy into fo…
Browse files Browse the repository at this point in the history
…utoucour-master

Conflicts:
	tweepy/api.py
  • Loading branch information
Aaron1011 committed May 3, 2014
2 parents fad037b + 8bb1dcf commit 90ca6e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

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'
Expand Down Expand Up @@ -33,6 +34,9 @@ def testgetoembed(self):
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()
Expand Down
13 changes: 12 additions & 1 deletion tweepy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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


Expand Down Expand Up @@ -38,6 +38,17 @@ def __init__(self, auth_handler=None,
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',
Expand Down

0 comments on commit 90ca6e6

Please sign in to comment.