Closed lupulabs closed 1 year ago
the skeleton for the twitter plugin is here
as said the curly Danners, it needs the logic of the comunication with the twitter api in the following lines:
import requests
class TwitterModule:
def __init__(self):
self.options = [{
'name': 'CLIENT_ID',
'value': '',
'required': True,
'description': "linkedin api's client id"
}, {
'name': 'CLIENT_SECRET',
'value': '',
'required': True,
'description': "linkedin api's client secret"
}]
def run(self):
print("corriendo plugin kaker")
those methods are called by the cmd2 object, the list of methods are not standard
loading the lib:
here is the where the object y instanced
@cmd2.with_argparser(parser_use)
def do_use(self, args):
self.prompt = f"{Fore.RED}boom{Style.RESET_ALL}({args.plugin})> "
self.plugin_name = args.plugin
if args.plugin == 'twitter':
self.plugin_instance = TwitterModule()
if we try to run this module, the program said:
the plugin is not implemented yet
but with the following modification, we could have a hello world:
diff --git a/cli/boom.py b/cli/boom.py
index 73edbfc..e42a401 100644
--- a/cli/boom.py
+++ b/cli/boom.py
@@ -201,6 +201,12 @@ class FirstApp(cmd2.Cmd):
tab.add_rows(fields[1:])
print(tab)
+ elif self.plugin_name == 'twitter':
+ cmd = args.arg_list[0]
+ if cmd == 'do_something':
+ self.plugin_instnace.run():
+ elif cmd == 'help':
+ print("it needs a good help message")
else:
print(f"[{Fore.RED}-{Style.RESET_ALL}] Not implemented yet...")
Hi, I thought that the twitter version could be useful
Could you add this plugin?