import mimetypes
import os
-import six
-
from tweepy.binder import bind_api, pagination
from tweepy.error import TweepError
from tweepy.parsers import ModelParser, Parser
elif file_type not in ['image/gif', 'image/jpeg', 'image/png']:
raise TweepError('Invalid file type for image: %s' % file_type)
- if isinstance(filename, six.text_type):
+ if isinstance(filename, str):
filename = filename.encode('utf-8')
BOUNDARY = b'Tw3ePy'
import logging
import requests
-import six
from requests.auth import AuthBase
from requests_oauthlib import OAuth1, OAuth1Session
from urllib.parse import parse_qs
OAUTH_ROOT = '/oauth/'
def __init__(self, consumer_key, consumer_secret, callback=None):
- if type(consumer_key) == six.text_type:
+ if type(consumer_key) == str:
consumer_key = consumer_key.encode('ascii')
- if type(consumer_secret) == six.text_type:
+ if type(consumer_secret) == str:
consumer_secret = consumer_secret.encode('ascii')
self.consumer_key = consumer_key
# Copyright 2009-2020 Joshua Roesslein
# See LICENSE for details.
-import six
-
class TweepError(Exception):
"""Tweepy exception"""
def __init__(self, reason, response=None, api_code=None):
- self.reason = six.text_type(reason)
+ self.reason = str(reason)
self.response = response
self.api_code = api_code
super(TweepError, self).__init__(reason)
if self.running:
raise TweepError('Stream object already connected!')
self.url = '/%s/site.json' % STREAM_VERSION
- self.body['follow'] = ','.join(map(six.text_type, follow))
+ self.body['follow'] = ','.join(map(str, follow))
self.body['delimited'] = 'length'
if stall_warnings:
self.body['stall_warnings'] = stall_warnings
from datetime import datetime
from email.utils import parsedate
-import six
-
def parse_datetime(string):
return datetime(*(parsedate(string)[:6]))
def convert_to_utf8_str(arg):
# written by Michael Norton (http://docondev.blogspot.com/)
- if isinstance(arg, six.text_type):
+ if isinstance(arg, str):
arg = arg.encode('utf-8')
elif not isinstance(arg, bytes):
- arg = six.text_type(arg).encode('utf-8')
+ arg = str(arg).encode('utf-8')
return arg