diff --git a/Makefile b/Makefile index 76039c40..c05f934b 100644 --- a/Makefile +++ b/Makefile @@ -37,11 +37,11 @@ docs: $(MAKE) -C doc html lint: - pycodestyle --config={toxinidir}/setup.cfg twitter tests + pycodestyle --config={toxinidir}/setup.cfg twitter_api tests test: lint - pytest -s - #python setup.py test + # pytest -s + python3 setup.py test tox: clean tox diff --git a/examples/get_all_user_tweets.py b/examples/get_all_user_tweets.py index 96524250..ef286628 100644 --- a/examples/get_all_user_tweets.py +++ b/examples/get_all_user_tweets.py @@ -16,7 +16,7 @@ import json import sys -import twitter +import twitter_api as twitter from t import ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET, CONSUMER_KEY, CONSUMER_SECRET diff --git a/examples/twitter-to-xhtml.py b/examples/twitter-to-xhtml.py index 57b38470..bffa7108 100755 --- a/examples/twitter-to-xhtml.py +++ b/examples/twitter-to-xhtml.py @@ -23,7 +23,7 @@ import sys import argparse -import twitter +import twitter_api as twitter from t import * diff --git a/examples/view_friends.py b/examples/view_friends.py index 499849fe..db520936 100644 --- a/examples/view_friends.py +++ b/examples/view_friends.py @@ -27,7 +27,7 @@ # from __future__ import print_function -import twitter +import twitter_api as twitter CONSUMER_KEY = 'WWWWWWWW' CONSUMER_SECRET = 'XXXXXXXX' diff --git a/setup.cfg b/setup.cfg index ffcde717..b6836f9e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,5 +14,5 @@ ignore = ignore = E111,E124,E126,E221,E501 [pycodestyle] -ignore = E111,E124,E126,E221,E501 +ignore = E111,E124,E126,E221,E501,E741 max-line-length = 100 diff --git a/setup.py b/setup.py index 1a0a4120..ff69db6f 100755 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def read(filename): with codecs.open(os.path.join(cwd, filename), 'rb', 'utf-8') as h: return h.read() -metadata = read(os.path.join(cwd, 'twitter', '__init__.py')) +metadata = read(os.path.join(cwd, 'twitter_api', '__init__.py')) def extract_metaitem(meta): # swiped from https://hynek.me 's attr package @@ -70,8 +70,8 @@ def extract_metaitem(meta): 'Topic :: Internet', 'Programming Language :: Python', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', + # 'Programming Language :: Python :: 2.7', + # 'Programming Language :: Python :: 3', + # 'Programming Language :: Python :: 3.6', ], ) diff --git a/tests/test_api_30.py b/tests/test_api_30.py index 1cd09f49..75de624e 100644 --- a/tests/test_api_30.py +++ b/tests/test_api_30.py @@ -13,7 +13,7 @@ from mock import patch import warnings -import twitter +import twitter_api as twitter import responses from responses import GET, POST @@ -1762,7 +1762,7 @@ def testShowFriendship(self): ) @responses.activate - @patch('twitter.api.Api.UploadMediaChunked') + @patch('twitter_api.api.Api.UploadMediaChunked') def test_UploadSmallVideoUsesChunkedData(self, mocker): responses.add(POST, DEFAULT_URL, body='{}') video = NamedTemporaryFile(suffix='.mp4') diff --git a/tests/test_direct_messages.py b/tests/test_direct_messages.py index a477a16a..fc83aad2 100644 --- a/tests/test_direct_messages.py +++ b/tests/test_direct_messages.py @@ -5,7 +5,7 @@ import re -import twitter +import twitter_api as twitter import responses from responses import GET, POST diff --git a/tests/test_error_handling.py b/tests/test_error_handling.py index 22c6a47b..c0d75b6e 100644 --- a/tests/test_error_handling.py +++ b/tests/test_error_handling.py @@ -7,7 +7,7 @@ import unittest import warnings -import twitter +import twitter_api as twitter import responses from responses import GET, POST diff --git a/tests/test_filecache.py b/tests/test_filecache.py index 36d5d4a5..09b9a770 100644 --- a/tests/test_filecache.py +++ b/tests/test_filecache.py @@ -1,4 +1,4 @@ -import twitter +import twitter_api as twitter import unittest import time diff --git a/tests/test_friendship.py b/tests/test_friendship.py index 1b644bd3..afbb6583 100644 --- a/tests/test_friendship.py +++ b/tests/test_friendship.py @@ -13,7 +13,7 @@ from mock import patch import warnings -import twitter +import twitter_api as twitter import responses from responses import GET, POST diff --git a/tests/test_media.py b/tests/test_media.py index 2cacb7a4..031e3631 100644 --- a/tests/test_media.py +++ b/tests/test_media.py @@ -3,7 +3,7 @@ import json import unittest -import twitter +import twitter_api as twitter class MediaTest(unittest.TestCase): diff --git a/tests/test_models.py b/tests/test_models.py index ed56fb47..3945325a 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,4 +1,4 @@ -import twitter +import twitter_api as twitter import json import re import unittest diff --git a/tests/test_parse_tweet.py b/tests/test_parse_tweet.py index 66cdb4d5..ca308b7c 100644 --- a/tests/test_parse_tweet.py +++ b/tests/test_parse_tweet.py @@ -1,7 +1,7 @@ # encoding: utf-8 import unittest -import twitter +import twitter_api as twitter class ParseTest(unittest.TestCase): diff --git a/tests/test_rate_limit.py b/tests/test_rate_limit.py index 52db1ca3..c36cc21b 100644 --- a/tests/test_rate_limit.py +++ b/tests/test_rate_limit.py @@ -6,7 +6,7 @@ import unittest import warnings -import twitter +import twitter_api as twitter import responses from responses import GET, POST diff --git a/tests/test_searching.py b/tests/test_searching.py index 92f3ff88..6e273fe8 100644 --- a/tests/test_searching.py +++ b/tests/test_searching.py @@ -13,7 +13,7 @@ from mock import patch import warnings -import twitter +import twitter_api as twitter import responses from responses import GET, POST diff --git a/tests/test_status.py b/tests/test_status.py index 475ac154..420979ee 100644 --- a/tests/test_status.py +++ b/tests/test_status.py @@ -1,7 +1,7 @@ # encoding: utf-8 import sys -import twitter +import twitter_api as twitter import calendar import time import json diff --git a/tests/test_streaming.py b/tests/test_streaming.py index ed9864f5..f897beba 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -6,7 +6,7 @@ import json import unittest -import twitter +import twitter_api as twitter def test_streaming_extended_tweet(): diff --git a/tests/test_trend.py b/tests/test_trend.py index ac00e325..bc6e2135 100644 --- a/tests/test_trend.py +++ b/tests/test_trend.py @@ -1,4 +1,4 @@ -import twitter +import twitter_api as twitter import unittest import json diff --git a/tests/test_tweet_changes.py b/tests/test_tweet_changes.py index bec70f6f..c1224b16 100644 --- a/tests/test_tweet_changes.py +++ b/tests/test_tweet_changes.py @@ -7,7 +7,7 @@ import unittest import warnings -import twitter +import twitter_api as twitter import responses from responses import GET diff --git a/tests/test_tweet_length.py b/tests/test_tweet_length.py index 288dc32e..3d7d088b 100644 --- a/tests/test_tweet_length.py +++ b/tests/test_tweet_length.py @@ -1,7 +1,7 @@ # encoding: utf-8 import unittest -import twitter +import twitter_api as twitter class TestTweetLength(unittest.TestCase): diff --git a/tests/test_twitter_utils.py b/tests/test_twitter_utils.py index cd162bd5..ab8b7f12 100644 --- a/tests/test_twitter_utils.py +++ b/tests/test_twitter_utils.py @@ -6,13 +6,13 @@ import responses -import twitter -from twitter.twitter_utils import ( +import twitter_api as twitter +from twitter_api.twitter_utils import ( calc_expected_status_length, parse_media_file ) -from twitter import twitter_utils as utils +from twitter_api import twitter_utils as utils if sys.version_info > (3,): unicode = str diff --git a/tests/test_unicode.py b/tests/test_unicode.py index 5d10aa39..54b4c644 100644 --- a/tests/test_unicode.py +++ b/tests/test_unicode.py @@ -12,7 +12,7 @@ from hypothesis import given, example from hypothesis import strategies as st -import twitter +import twitter_api as twitter warnings.filterwarnings('ignore', category=DeprecationWarning) diff --git a/tests/test_url_regex.py b/tests/test_url_regex.py index 1de1dca7..200bf557 100644 --- a/tests/test_url_regex.py +++ b/tests/test_url_regex.py @@ -7,8 +7,8 @@ import unittest import warnings -import twitter -from twitter import twitter_utils +import twitter_api as twitter +from twitter_api import twitter_utils import responses from responses import GET, POST diff --git a/tests/test_user.py b/tests/test_user.py index 83f9d35c..6475c338 100644 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -1,4 +1,4 @@ -import twitter +import twitter_api as twitter import json import unittest diff --git a/twitter/__init__.py b/twitter_api/__init__.py similarity index 100% rename from twitter/__init__.py rename to twitter_api/__init__.py diff --git a/twitter/_file_cache.py b/twitter_api/_file_cache.py similarity index 100% rename from twitter/_file_cache.py rename to twitter_api/_file_cache.py diff --git a/twitter/api.py b/twitter_api/api.py similarity index 99% rename from twitter/api.py rename to twitter_api/api.py index 13d88799..f7e2e512 100755 --- a/twitter/api.py +++ b/twitter_api/api.py @@ -43,7 +43,7 @@ from urllib import urlencode, quote_plus from urllib import __version__ as urllib_version -from twitter import ( +from twitter_api import ( __version__, _FileCache, Category, @@ -55,16 +55,16 @@ UserStatus, ) -from twitter.ratelimit import RateLimit +from twitter_api.ratelimit import RateLimit -from twitter.twitter_utils import ( +from twitter_api.twitter_utils import ( calc_expected_status_length, is_url, parse_media_file, enf_type, parse_arg_list) -from twitter.error import ( +from twitter_api.error import ( TwitterError, PythonTwitterDeprecationWarning330, ) diff --git a/twitter/error.py b/twitter_api/error.py similarity index 100% rename from twitter/error.py rename to twitter_api/error.py diff --git a/twitter/models.py b/twitter_api/models.py similarity index 99% rename from twitter/models.py rename to twitter_api/models.py index e8974ebe..924c69fd 100644 --- a/twitter/models.py +++ b/twitter_api/models.py @@ -378,7 +378,7 @@ def __repr__(self): @classmethod def NewFromJsonDict(cls, data, **kwargs): - from twitter import Status + from twitter_api import Status if data.get('status', None): status = Status.NewFromJsonDict(data.get('status')) return super(cls, cls).NewFromJsonDict(data=data, status=status) diff --git a/twitter/parse_tweet.py b/twitter_api/parse_tweet.py similarity index 100% rename from twitter/parse_tweet.py rename to twitter_api/parse_tweet.py diff --git a/twitter/ratelimit.py b/twitter_api/ratelimit.py similarity index 99% rename from twitter/ratelimit.py rename to twitter_api/ratelimit.py index 3a717b38..32bd555a 100644 --- a/twitter/ratelimit.py +++ b/twitter_api/ratelimit.py @@ -5,7 +5,7 @@ except ImportError: from urlparse import urlparse -from twitter.twitter_utils import enf_type +from twitter_api.twitter_utils import enf_type EndpointRateLimit = namedtuple('EndpointRateLimit', ['limit', 'remaining', 'reset']) diff --git a/twitter/twitter_utils.py b/twitter_api/twitter_utils.py similarity index 99% rename from twitter/twitter_utils.py rename to twitter_api/twitter_utils.py index a4a07a36..0156810d 100644 --- a/twitter/twitter_utils.py +++ b/twitter_api/twitter_utils.py @@ -15,8 +15,8 @@ from urlparse import urlparse import requests -from twitter import TwitterError -import twitter +from twitter_api import TwitterError +import twitter_api if sys.version_info < (3,): range = xrange # noqa @@ -336,12 +336,12 @@ def parse_arg_list(args, attr): out = [] if isinstance(args, (str, unicode)): out.append(args) - elif isinstance(args, twitter.User): + elif isinstance(args, twitter_api.User): out.append(getattr(args, attr)) elif isinstance(args, (list, tuple)): for item in args: if isinstance(item, (str, unicode)): out.append(item) - elif isinstance(item, twitter.User): + elif isinstance(item, twitter_api.User): out.append(getattr(item, attr)) return ",".join([str(item) for item in out])