Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 54 lines (44 sloc) 1.709 kB
76c8c51 @wagnerrp Move interactive access to separate script.
authored
1 #!/usr/bin/env python
2
3 from optparse import OptionParser
4 from tmdb3 import *
5
6 import sys
7
8 if __name__ == '__main__':
9 # this key is registered to this library for testing purposes.
10 # please register for your own key if you wish to use this
11 # library in your own application.
12 # http://help.themoviedb.org/kb/api/authentication-basics
13 set_key('1acd79ff610c77f3040073d004f7f5b0')
14
15 parser = OptionParser()
16 parser.add_option('-v', "--version", action="store_true", default=False,
17 dest="version", help="Display version.")
18 parser.add_option('-d', "--debug", action="store_true", default=False,
19 dest="debug", help="Enables verbose debugging.")
20 parser.add_option('-c', "--no-cache", action="store_true", default=False,
21 dest="nocache", help="Disables request cache.")
22 opts, args = parser.parse_args()
23
24 if opts.version:
25 from tmdb3.tmdb_api import __title__, __purpose__, __version__, __author__
26 print __title__
27 print ""
28 print __purpose__
29 print "Version: "+__version__
30 sys.exit(0)
31
32 # TODO: make this actually do something
33 # if opts.debug:
34 # DEBUG = True
35
36 if opts.nocache:
37 set_cache(engine='null')
38 else:
39 set_cache(engine='file', filename='/tmp/pytmdb3.cache')
40
41 banner = 'PyTMDB3 Interactive Shell.'
42 import code
43 try:
44 import readline, rlcompleter
45 except ImportError:
46 pass
47 else:
48 readline.parse_and_bind("tab: complete")
49 banner += ' TAB completion available.'
50 namespace = globals().copy()
51 namespace.update(locals())
52 code.InteractiveConsole(namespace).interact(banner)
53
Something went wrong with that request. Please try again.