Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
tweepy
Commits
62eb3da8
Unverified
Commit
62eb3da8
authored
Jun 02, 2018
by
Joshua Roesslein
Committed by
GitHub
Jun 02, 2018
Browse files
Merge pull request #1043 from hugovk/rm-eol
Remove redundant Python 2.6 and 3.3 code
parents
605da21f
8f62489d
Changes
14
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
62eb3da8
...
...
@@ -21,7 +21,7 @@ GitHub and install it manually:
cd tweepy
python setup.py install
Python 2.
6 and 2.7, 3.3
, 3.4, 3.5 & 3.6 are supported.
Python 2.
7
, 3.4, 3.5 & 3.6 are supported.
Community
---------
...
...
setup.py
View file @
62eb3da8
...
...
@@ -28,6 +28,7 @@ setup(name="tweepy",
"PySocks>=1.5.7"
,
],
keywords
=
"twitter library"
,
python_requires
=
'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'
,
classifiers
=
[
'Development Status :: 4 - Beta'
,
'Topic :: Software Development :: Libraries'
,
...
...
@@ -35,10 +36,8 @@ setup(name="tweepy",
'Operating System :: OS Independent'
,
'Programming Language :: Python'
,
'Programming Language :: Python :: 2'
,
'Programming Language :: Python :: 2.6'
,
'Programming Language :: Python :: 2.7'
,
'Programming Language :: Python :: 3'
,
'Programming Language :: Python :: 3.3'
,
'Programming Language :: Python :: 3.4'
,
'Programming Language :: Python :: 3.5'
,
'Programming Language :: Python :: 3.6'
,
...
...
test_requirements.txt
View file @
62eb3da8
tox
>=1.7.2
vcrpy
==1.10.3
mock
==1.0.1
unittest2
# Comment this line out if using Python 3.
tests/config.py
View file @
62eb3da8
import
os
import
unittest
import
vcr
from
tweepy.auth
import
OAuthHandler
from
tweepy.api
import
API
import
six
if
six
.
PY3
:
import
unittest
else
:
import
unittest2
as
unittest
username
=
os
.
environ
.
get
(
'TWITTER_USERNAME'
,
'tweepytest'
)
oauth_consumer_key
=
os
.
environ
.
get
(
'CONSUMER_KEY'
,
''
)
...
...
tests/test_api.py
View file @
62eb3da8
...
...
@@ -397,7 +397,7 @@ class TweepyAPITests(TweepyTestCase):
def
testgeoapis
(
self
):
def
place_name_in_list
(
place_name
,
place_list
):
"""Return True if a given place_name is in place_list."""
return
any
(
[
x
.
full_name
.
lower
()
==
place_name
.
lower
()
for
x
in
place_list
]
)
return
any
(
x
.
full_name
.
lower
()
==
place_name
.
lower
()
for
x
in
place_list
)
twitter_hq
=
self
.
api
.
geo_similar_places
(
lat
=
'37.7821120598956'
,
long
=
'-122.400612831116'
,
...
...
tests/test_auth.py
View file @
62eb3da8
...
...
@@ -3,13 +3,9 @@ from __future__ import absolute_import
from
.config
import
*
from
tweepy
import
API
,
OAuthHandler
import
six
import
random
import
unittest
if
six
.
PY3
:
import
unittest
else
:
import
unittest2
as
unittest
class
TweepyAuthTests
(
unittest
.
TestCase
):
...
...
tests/test_cursors.py
View file @
62eb3da8
from
tweepy
import
Cursor
from
.config
import
create_auth
from
.config
import
TweepyTestCase
,
username
,
use_replay
,
tape
import
six
if
six
.
PY3
:
import
unittest
else
:
import
unittest2
as
unittest
from
.config
import
TweepyTestCase
,
username
,
tape
class
TweepyCursorTests
(
TweepyTestCase
):
...
...
tests/test_rate_limit.py
View file @
62eb3da8
import
unittest
import
os
import
unittest
from
tweepy
import
API
,
Cursor
from
tweepy
import
API
from
tweepy.error
import
TweepError
import
six
if
six
.
PY3
:
import
unittest
else
:
import
unittest2
as
unittest
from
.config
import
create_auth
testratelimit
=
'TEST_RATE_LIMIT'
in
os
.
environ
...
...
@@ -20,7 +15,7 @@ class TweepyRateLimitTests(unittest.TestCase):
self
.
api
=
API
(
create_auth
())
self
.
api
.
retry_count
=
2
self
.
api
.
retry_delay
=
5
self
.
api
.
retry_errors
=
set
([
401
,
404
,
503
])
self
.
api
.
retry_errors
=
{
401
,
404
,
503
}
self
.
api
.
wait_on_rate_limit
=
True
def
testratelimit
(
self
):
...
...
@@ -31,7 +26,7 @@ class TweepyRateLimitTests(unittest.TestCase):
self
.
api
.
user_timeline
(
user_id
=
user_id
,
count
=
1
,
include_rts
=
True
)
except
TweepError
as
e
:
# continue if we're not autherized to access the user's timeline or she doesn't exist anymore
if
e
.
response
is
not
None
and
e
.
response
.
status
in
set
([
401
,
404
]):
if
e
.
response
is
not
None
and
e
.
response
.
status
in
{
401
,
404
}:
continue
raise
e
...
...
tests/test_streaming.py
View file @
62eb3da8
from
__future__
import
absolute_import
,
print_function
from
.config
import
tape
import
six
if
six
.
PY3
:
import
unittest
from
unittest.case
import
skip
else
:
import
unittest2
as
unittest
from
unittest2.case
import
skip
import
unittest
from
unittest.case
import
skip
from
tweepy.api
import
API
from
tweepy.auth
import
OAuthHandler
...
...
tests/test_utils.py
View file @
62eb3da8
import
six
if
six
.
PY3
:
import
unittest
else
:
import
unittest2
as
unittest
from
tweepy.utils
import
*
import
random
import
string
import
unittest
def
mock_tweet
():
"""Generate some random tweet text."""
...
...
tox.ini
View file @
62eb3da8
...
...
@@ -4,7 +4,7 @@
# and then run "tox" from this directory.
[tox]
envlist
=
py2
6, py27, py33
, py34, py35, py36
envlist
=
py2
7
, py34, py35, py36
[base]
deps
=
...
...
@@ -12,17 +12,6 @@ deps =
vcrpy
=
=1.0.2
mock
=
=1.0.1
[py2]
deps
=
{
[base]
deps}
unittest2
=
=0.5.1
[testenv:py27]
deps
=
{[py2]deps}
[testenv:py26]
deps
=
{[py2]deps}
[testenv]
commands
=
nosetests -v tests.test_cursors tests.test_api tests.test_utils
deps
=
...
...
tweepy/api.py
View file @
62eb3da8
...
...
@@ -1324,7 +1324,7 @@ class API(object):
filename
=
filename
.
encode
(
"utf-8"
)
BOUNDARY
=
b
'Tw3ePy'
body
=
list
()
body
=
[]
body
.
append
(
b
'--'
+
BOUNDARY
)
body
.
append
(
'Content-Disposition: form-data; name="{0}";'
' filename="{1}"'
.
format
(
form_field
,
filename
)
...
...
tweepy/cache.py
View file @
62eb3da8
...
...
@@ -6,6 +6,7 @@ from __future__ import print_function
import
time
import
datetime
import
hashlib
import
threading
import
os
import
logging
...
...
@@ -15,12 +16,6 @@ try:
except
ImportError
:
import
pickle
try
:
import
hashlib
except
ImportError
:
# python 2.4
import
md5
as
hashlib
try
:
import
fcntl
except
ImportError
:
...
...
tweepy/utils.py
View file @
62eb3da8
...
...
@@ -7,7 +7,6 @@ from __future__ import print_function
from
datetime
import
datetime
import
six
from
six.moves.urllib.parse
import
quote
from
email.utils
import
parsedate
...
...
@@ -41,14 +40,7 @@ def import_simplejson():
try
:
import
simplejson
as
json
except
ImportError
:
try
:
import
json
# Python 2.6+
except
ImportError
:
try
:
# Google App Engine
from
django.utils
import
simplejson
as
json
except
ImportError
:
raise
ImportError
(
"Can't load a json library"
)
import
json
return
json
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment