Example #1
0
def login():
    global api, me
    try:
        auth = tweepy.OAuthHandler(config.consumer_key, config.consumer_secret)
        auth.set_access_token(config.access_token, config.access_token_secret)
        api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
        me  = api.me()
    except tweepy.TweepError:
        debug.error_exit('Failed to login to Twitter!')
Example #2
0
def main(argv, module=False):
    """The main functionality of the program. It processes the given arguments and
        then calls the required functionality given by the other modules.

    Args:
        argv (list): The argument vector with which the module is called. I. e.
            the command-line arguments if called from command line or a list of strings
            if called as a module.
        module (bool): Specifies whether the module was called from command line or by another module.
            This allows to adjust the argv arguments.
    """
    # Read command line options
    args = oi.read_options(argv, module=module)

    # Initialize logging
    debug.init_log(sys.stderr, args.logging)

    # Extract visualization options from options
    visualization_options = viz.read_options(args)

    if args.command == 'rankestimation':
        names, x = load(args)

        rank = mv.estimate_rank(x,
                                visualization_options,
                                num_seeds=args.num_seeds,
                                k_fold_rows=args.k_fold_rows,
                                k_fold_cols=args.k_fold_cols)

    elif args.command == 'kdistance':
        names, x = load(args)

        x_pca = ca.pca(x, args.rank)
        mv.k_distance(x_pca, visualization_options)

    elif args.command == 'pcadbscan':
        names, x = load(args)

        x2d, labels = ca.pca_dbscan_projection(
            x,
            args.rank,
            args.epsilon,
            args.min_samples,
            projection_dimension=args.projection_dimension)

    elif args.command == 'plot':
        plots.plot_visualization(args.path,
                                 args.file,
                                 args.energies,
                                 args.plots,
                                 visualization_options,
                                 normalize=args.no_normalize,
                                 remove=args.remove,
                                 elements=args.elements)

    else:
        debug.error_exit(1, 'Nothing to do. Exiting...')
Example #3
0
 def login(self):
     try:
         auth = tweepy.OAuthHandler(config.consumer_key,
                                    config.consumer_secret)
         auth.set_access_token(config.access_token,
                               config.access_token_secret)
         self.api = tweepy.API(auth,
                               wait_on_rate_limit=True,
                               wait_on_rate_limit_notify=True)
         self.me = self.api.me()
     except tweepy.TweepError as ex:
         debug.error_exit('Failed to login to Twitter! ({0})'.format(
             str(ex)))
Example #4
0
#!/usr/bin/env python
# IRC Cryptocurrency Exchange (IRCCEX)
# Developed by acidvegas in Python
# https://git.supernets.org/acidvegas/irccex
# irccex.py

import os
import sys

sys.dont_write_bytecode = True
os.chdir(sys.path[0] or '.')
sys.path += ('core','modules')

import debug

debug.setup_logger()
debug.info()
if not debug.check_version(3):
	debug.error_exit('Python 3 is required!')
if debug.check_privileges():
	debug.error_exit('Do not run as admin/root!')
import irc
irc.Bot.run()
Example #5
0
#!/usr/bin/env python
# Chir.py Twitter Bot - Developed by acidvegas in Python (https://acid.vegas/chir.py)
# chir.py

import sys

sys.dont_write_bytecode = True

import debug

debug.info()
if not debug.check_version(3):
    debug.error_exit('Chir.py requires Python version 3 to run!')
if not debug.get_windows():
    if debug.check_root():
        debug.error_exit('Do not run Chir.py as root!')
debug.check_imports()
debug.check_config()
import twitter
twitter.login()
twitter.main_loop()
debug.keep_alive()
Example #6
0
	def event_nick_in_use(self):
		debug.error_exit('BlackJack is already running.')
Example #7
0
#!/usr/bin/env python
# Booster Twitter Bot
# Developed by acidvegas in Python
# https://git.acid.vegas/booster
# booster.py

import sys

sys.dont_write_bytecode = True

import debug

debug.info()
if not debug.check_version(3):
    debug.error_exit('Requires Python version 3 to run!')
if debug.check_privileges():
    debug.error_exit('Do not run as admin/root!')
debug.check_imports()
debug.check_config()
import twitter
twitter.Booster().run()
debug.keep_alive()
Example #8
0
#!/usr/bin/env python
# Booster Twitter Bot
# Developed by acidvegas in Python 3
# https://github.com/acidvegas/booster
# booster.py

import sys

sys.dont_write_bytecode = True

import debug

debug.info()
if not debug.check_version(3):
    debug.error_exit('Booster requires Python version 3 to run!')
if debug.check_privileges():
    debug.error_exit('Do not run Booster as admin/root!')
debug.check_imports()
debug.check_config()
import twitter
twitter.Booster().run()
debug.keep_alive()
Example #9
0
import config
import constants
import database
import debug
import functions

# Load optional modules
if config.connection.ssl:
    import ssl
if config.connection.proxy:
    try:
        import sock
    except ImportError:
        debug.error_exit(
            'Missing PySocks module! (https://pypi.python.org/pypi/PySocks)'
        )  # Required for proxy support.


def color(msg, foreground, background=None):
    if background:
        return f'\x03{foreground},{background}{msg}{constants.reset}'
    else:
        return f'\x03{foreground}{msg}{constants.reset}'


class IRC(object):
    def __init__(self):
        self.last = 0
        self.slow = False
        self.sock = None
Example #10
0
#!/usr/bin/env python
# BlackJack IRC Bot
# Developed by acidvegas in Python
# https://git.acid.vegas/blackjack
# blackjack.py

import os
import sys

sys.dont_write_bytecode = True
os.chdir(sys.path[0] or '.')
sys.path += ('core', )

import debug

debug.info()
if not debug.check_version(3):
    debug.error_exit('BlackJack requires Python 3!')
elif debug.check_privileges():
    debug.error_exit('Do not run BlackJack as admin/root!')
import irc
irc.BlackJack.connect()