Bots/Instrumentation: Difference between revisions
From charlesreid1
No edit summary |
m (Replacing charlesreid1.com:3000 with git.charlesreid1.com) |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
==notes== | |||
Categorizing bots: | Categorizing bots: | ||
* currently, we have logging capacity | * currently, we have logging capacity | ||
| Line 4: | Line 6: | ||
* logging functionality may need fixing... | * logging functionality may need fixing... | ||
https://charlesreid1.com: | approach: | ||
* passing full information to logging object | |||
* logging object decides what to do | |||
* want to be able to say, dump to log file, dump to database | |||
* enable log file dumping and set a log dump file | |||
* enable database dumping and set connection information | |||
==code== | |||
https://git.charlesreid1.com/charlesreid1/apollospacejunk | |||
https://git.charlesreid1.com/charlesreid1/rainbow-mind-machine | |||
https://git.charlesreid1.com/charlesreid1/rainbow-mind-machine/src/master/rainbowmindmachine/Sheep.py#L348 | |||
<pre> | |||
def _tweet(self,twit): | |||
""" | |||
Private method. | |||
Publish a twit. | |||
""" | |||
# call twitter api to tweet the twit | |||
try: | |||
# tweet: | |||
#stats = self.t.statuses.update(status=twit) | |||
self.t.statuses.update(status=twit) | |||
msg = self.timestamp_message(">>> Tweet was successful: %s"%(twit)) | |||
logging.info(msg) | |||
</pre> | |||
==flags== | |||
[[Category:2018]] | |||
[[Category:February 2018]] | |||
[[Category:Bots]] | [[Category:Bots]] | ||
Latest revision as of 03:18, 9 October 2019
notes
Categorizing bots:
- currently, we have logging capacity
- what we need is a database module for logging
- logging functionality may need fixing...
approach:
- passing full information to logging object
- logging object decides what to do
- want to be able to say, dump to log file, dump to database
- enable log file dumping and set a log dump file
- enable database dumping and set connection information
code
https://git.charlesreid1.com/charlesreid1/apollospacejunk
https://git.charlesreid1.com/charlesreid1/rainbow-mind-machine
def _tweet(self,twit):
"""
Private method.
Publish a twit.
"""
# call twitter api to tweet the twit
try:
# tweet:
#stats = self.t.statuses.update(status=twit)
self.t.statuses.update(status=twit)
msg = self.timestamp_message(">>> Tweet was successful: %s"%(twit))
logging.info(msg)