Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/get_all_user_tweets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion examples/twitter-to-xhtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import sys
import argparse

import twitter
import twitter_api as twitter

from t import *

Expand Down
2 changes: 1 addition & 1 deletion examples/view_friends.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#

from __future__ import print_function
import twitter
import twitter_api as twitter

CONSUMER_KEY = 'WWWWWWWW'
CONSUMER_SECRET = 'XXXXXXXX'
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
],
)
4 changes: 2 additions & 2 deletions tests/test_api_30.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from mock import patch
import warnings

import twitter
import twitter_api as twitter

import responses
from responses import GET, POST
Expand Down Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_direct_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import re

import twitter
import twitter_api as twitter

import responses
from responses import GET, POST
Expand Down
2 changes: 1 addition & 1 deletion tests/test_error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import unittest
import warnings

import twitter
import twitter_api as twitter
import responses
from responses import GET, POST

Expand Down
2 changes: 1 addition & 1 deletion tests/test_filecache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import twitter
import twitter_api as twitter
import unittest
import time

Expand Down
2 changes: 1 addition & 1 deletion tests/test_friendship.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from mock import patch
import warnings

import twitter
import twitter_api as twitter

import responses
from responses import GET, POST
Expand Down
2 changes: 1 addition & 1 deletion tests/test_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
import unittest

import twitter
import twitter_api as twitter


class MediaTest(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import twitter
import twitter_api as twitter
import json
import re
import unittest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parse_tweet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8

import unittest
import twitter
import twitter_api as twitter


class ParseTest(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rate_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import unittest
import warnings

import twitter
import twitter_api as twitter
import responses
from responses import GET, POST

Expand Down
2 changes: 1 addition & 1 deletion tests/test_searching.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from mock import patch
import warnings

import twitter
import twitter_api as twitter

import responses
from responses import GET, POST
Expand Down
2 changes: 1 addition & 1 deletion tests/test_status.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8

import sys
import twitter
import twitter_api as twitter
import calendar
import time
import json
Expand Down
2 changes: 1 addition & 1 deletion tests/test_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json
import unittest

import twitter
import twitter_api as twitter


def test_streaming_extended_tweet():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_trend.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import twitter
import twitter_api as twitter
import unittest
import json

Expand Down
2 changes: 1 addition & 1 deletion tests/test_tweet_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import unittest
import warnings

import twitter
import twitter_api as twitter
import responses
from responses import GET

Expand Down
2 changes: 1 addition & 1 deletion tests/test_tweet_length.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8

import unittest
import twitter
import twitter_api as twitter


class TestTweetLength(unittest.TestCase):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_twitter_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_url_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import twitter
import twitter_api as twitter
import json
import unittest

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions twitter/api.py → twitter_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion twitter/models.py → twitter_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion twitter/ratelimit.py → twitter_api/ratelimit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
8 changes: 4 additions & 4 deletions twitter/twitter_utils.py → twitter_api/twitter_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])