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
65a26c2b
Commit
65a26c2b
authored
Aug 19, 2012
by
Joshua Roesslein
Browse files
Deprecating and removing tweepyshell.
parent
80e5edd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/tweepyshell
deleted
100755 → 0
View file @
80e5edd6
#!/usr/bin/env python
from
getpass
import
getpass
from
optparse
import
OptionParser
import
tweepy
from
tweepy
import
API
,
BasicAuthHandler
"""Launch an interactive shell ready for Tweepy usage
This script is handy for debugging tweepy during development
or to just play around with the library.
It imports tweepy and creates an authenticated API instance (api)
using the credentials provided.
"""
opt
=
OptionParser
(
usage
=
'tweepyshell [options] <username> <password>'
)
opt
.
add_option
(
'-d'
,
'--debug'
,
action
=
'store_true'
,
dest
=
'debug'
,
help
=
'enable debug mode'
)
options
,
args
=
opt
.
parse_args
()
if
len
(
args
)
==
1
:
auth
=
BasicAuthHandler
(
args
[
0
],
getpass
())
elif
len
(
args
)
==
2
:
auth
=
BasicAuthHandler
(
args
[
0
],
args
[
1
])
else
:
auth
=
None
if
options
.
debug
:
tweepy
.
debug
()
local_ns
=
{
'tweepy'
:
tweepy
,
'api'
:
API
(
auth
)}
shellbanner
=
'<Tweepy shell>'
try
:
import
IPython
ipshell
=
IPython
.
Shell
.
IPShell
([
''
],
user_ns
=
local_ns
)
ipshell
.
mainloop
(
sys_exit
=
1
,
banner
=
shellbanner
)
except
ImportError
:
import
code
code
.
interact
(
shellbanner
,
local
=
local_ns
)
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