""" script to parse the url of bindings and find if the page exists or not """
+
+import os
import pprint
import re
-import os
import requests
__author__ = 'jordiriera'
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import os
+import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
from __future__ import absolute_import, print_function
-from tweepy.streaming import StreamListener
-from tweepy import OAuthHandler
-from tweepy import Stream
+from tweepy import OAuthHandler, Stream, StreamListener
# Go to http://apps.twitter.com and create an app.
# The consumer key and secret will be generated for you after
#!/usr/bin/env python
-#from distutils.core import setup
+
+# from distutils.core import setup
import re
-from setuptools import setup, find_packages
+from setuptools import find_packages, setup
VERSIONFILE = "tweepy/__init__.py"
ver_file = open(VERSIONFILE, "rt").read()
import os
import unittest
+
import vcr
-from tweepy.auth import OAuthHandler
from tweepy.api import API
+from tweepy.auth import OAuthHandler
username = os.environ.get('TWITTER_USERNAME', 'tweepytest')
-import unittest
+import os
import random
import shutil
import time
-import os
+import unittest
from ast import literal_eval
from nose import SkipTest
-from tweepy import Friendship, MemoryCache, FileCache, API
+from .config import tape, TweepyTestCase, use_replay, username
+from tweepy import API, FileCache, Friendship, MemoryCache
from tweepy.parsers import Parser
-from .config import TweepyTestCase, username, use_replay, tape
test_tweet_id = '266367358078169089'
tweet_text = 'testing 1000'
from __future__ import absolute_import
-from .config import *
-from tweepy import API, OAuthHandler
-
import random
import unittest
+from .config import *
+from tweepy import API, OAuthHandler
+
class TweepyAuthTests(unittest.TestCase):
+from .config import tape, TweepyTestCase, username
from tweepy import Cursor
-from .config import TweepyTestCase, username, tape
-
class TweepyCursorTests(TweepyTestCase):
@tape.use_cassette('testidcursoritems.json')
import os
import unittest
+from .config import create_auth
from tweepy import API
from tweepy.error import TweepError
-from .config import create_auth
-
testratelimit = 'TEST_RATE_LIMIT' in os.environ
+
@unittest.skipIf(not testratelimit, "skipping rate limiting test since testratelimit is not specified")
class TweepyRateLimitTests(unittest.TestCase):
import unittest
from unittest.case import skip
-from tweepy.api import API
-from tweepy.auth import OAuthHandler
-from tweepy.models import Status
-from tweepy.streaming import Stream, StreamListener, ReadBuffer
+from mock import MagicMock, patch
from .config import create_auth
from .test_utils import mock_tweet
-from mock import MagicMock, patch
+from tweepy.api import API
+from tweepy.auth import OAuthHandler
+from tweepy.models import Status
+from tweepy.streaming import ReadBuffer, Stream, StreamListener
if six.PY3:
-from tweepy.utils import *
-
import random
import string
import unittest
+from tweepy.utils import *
+
def mock_tweet():
"""Generate some random tweet text."""
__author__ = 'Joshua Roesslein'
__license__ = 'MIT'
-from tweepy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResults, ModelFactory, Category
-from tweepy.error import TweepError, RateLimitError
from tweepy.api import API
-from tweepy.cache import Cache, MemoryCache, FileCache
-from tweepy.auth import OAuthHandler, AppAuthHandler
-from tweepy.streaming import Stream, StreamListener
+from tweepy.auth import AppAuthHandler, OAuthHandler
+from tweepy.cache import Cache, FileCache, MemoryCache
from tweepy.cursor import Cursor
+from tweepy.error import RateLimitError, TweepError
+from tweepy.models import Category, DirectMessage, Friendship, ModelFactory, SavedSearch, SearchResults, Status, User
+from tweepy.streaming import Stream, StreamListener
# Global, unauthenticated instance of API
api = API()
# Copyright 2009-2019 Joshua Roesslein
# See LICENSE for details.
-import os
import mimetypes
+import os
import six
# Copyright 2009-2019 Joshua Roesslein
# See LICENSE for details.
-import six
import logging
-from tweepy.error import TweepError
-from tweepy.api import API
import requests
-from requests_oauthlib import OAuth1Session, OAuth1
+import six
from requests.auth import AuthBase
+from requests_oauthlib import OAuth1, OAuth1Session
from six.moves.urllib.parse import parse_qs
+from tweepy.api import API
+from tweepy.error import TweepError
+
WARNING_MESSAGE = """Warning! Due to a Twitter API bug, signin_with_twitter
and access_type don't always play nice together. Details
https://dev.twitter.com/discussions/21281"""
# Copyright 2009-2019 Joshua Roesslein
# See LICENSE for details.
-import time
+import logging
import re
+import sys
+import time
-from six.moves.urllib.parse import quote, urlencode
import requests
-
-import logging
-
-from tweepy.error import TweepError, RateLimitError, is_rate_limit_error_message
-from tweepy.utils import convert_to_utf8_str
-from tweepy.models import Model
import six
-import sys
+from six.moves.urllib.parse import quote, urlencode
+from tweepy.error import is_rate_limit_error_message, RateLimitError, TweepError
+from tweepy.models import Model
+from tweepy.utils import convert_to_utf8_str
re_path_template = re.compile('{\w+}')
log = logging.getLogger('tweepy.binder')
+
def bind_api(**config):
class APIMethod(object):
# Copyright 2009-2019 Joshua Roesslein
# See LICENSE for details.
-import time
import datetime
import hashlib
+import logging
import threading
+import time
import os
-import logging
try:
import cPickle as pickle
log = logging.getLogger('tweepy.cache')
+
class Cache(object):
"""Cache interface"""
import six
+
class TweepError(Exception):
"""Tweepy exception"""
from __future__ import absolute_import
-from tweepy.utils import parse_datetime, parse_html_value, parse_a_href
+from tweepy.utils import parse_a_href, parse_datetime, parse_html_value
class ResultSet(list):
# See LICENSE for details.
import json as json_lib
-from tweepy.models import ModelFactory
+
from tweepy.error import TweepError
+from tweepy.models import ModelFactory
class Parser(object):
from __future__ import absolute_import
+import json
import logging
import re
import requests
+import ssl
import sys
-import json
-from requests.exceptions import Timeout
from threading import Thread
from time import sleep
import six
+from requests.exceptions import Timeout
-import ssl
-
-from tweepy.models import Status
from tweepy.api import API
from tweepy.error import TweepError
+from tweepy.models import Status
STREAM_VERSION = '1.1'
# See LICENSE for details.
from datetime import datetime
+from email.utils import parsedate
import six
-from email.utils import parsedate
-
def parse_datetime(string):
return datetime(*(parsedate(string)[:6]))