Ejemplo n.º 1
0
    def updateHeadHunterResume(self, firefox_profile):
        try:
            logging.info("Trying update resume")

            options = Options()
            options.add_argument('--headless')
            driver = webdriver.Firefox(
                firefox_profile,
                options=options,
                service_log_path=ConfigLoader.getLogsPath(),
                executable_path=ConfigLoader.getGeckoDriverPath())
            driver.get(self.resume_page_url)

            rase_resume_button_active = driver.find_elements_by_xpath(
                self.xpath_rase_resume_button)

            if (len(rase_resume_button_active) != 0):
                for button in rase_resume_button_active:
                    button.click()
                logging.info('Resume on some profile updated successfully')

            else:
                logging.info(
                    "Can't update resume, button is not active, try again late"
                )

            driver.stop_client()
            driver.quit()

        except BaseException:
            logging.exception("Some error ocurred while rasing resume")
Ejemplo n.º 2
0
    def __init__(self):
        self.default_profile_folder = ConfigLoader.getProfileFolderPath()
        self.xpath_rase_resume_button = ConfigLoader.getUpdateButtonXpath()

        self.resume_page_url = ConfigLoader.getResumeUrl()
        self.login_page_url = ConfigLoader.getLoginUrl()

        self.profiles_list = ConfigLoader.getProfilesList()
Ejemplo n.º 3
0
def init_radiobot(config_file):
    """
        Initialize the different radiobot components :
        - Configuration loader, which will parse the json conf file and check
          attributes conformity
        - Display Manager, which is in charge of controling the LCD screen 
          and all the display behaviors (timers and so on)
        - Player manager, which is in charge of controlling VLC and Alsa 
          (starting and stoping network streams, applying volume modifications)
        - Radio manager, which is the overall manager, in charge of radio 
          selection and communication between the display and the player. 
    """
    global displayManager, configLoader, radioManager, playerManager

    # Loading GPIO configuration
    configure_GPIO()

    try:  # Trying to load configuration file
        configLoader = ConfigLoader(config_file)
        configLoader.parse_config_file()
        print("Configuration file loaded successfully")
    except Exception as e:
        print("Invalid configuration : " + str(e))
        print("Exciting.")
        sys.exit(2)

    # Loading display manager
    displayManager = DisplayManager(
        serial.Serial(configLoader.serial_device,
                      configLoader.serial_baud_rate,
                      timeout=1), configLoader.name, configLoader.halt_message,
        configLoader.volume_timer, configLoader.scroll_time_interval,
        configLoader.scroll_time_pause)
    displayManager.start()

    # Loading player
    playerManager = PlayerManager(configLoader.volume)

    # Loading the radio manager
    radioManager = RadioManager(configLoader.radios, configLoader.volume,
                                configLoader.volume_step,
                                configLoader.radio_info_check_interval,
                                configLoader.full_radio_name_pause,
                                configLoader.radio_indice, playerManager,
                                displayManager)

    # Declare radiobot "ready"
    set_as_ready()

    # Starting first radio
    radioManager.play_radio()
Ejemplo n.º 4
0
 def commandsFromButtons(cls):
     file_str = open(ConfigLoader.getKeyboard(), "r",
                     encoding="UTF-8").read()
     data = json.loads(file_str)
     for button in data['buttons'][0]:
         cls.m_command_map[button['action']
                           ['label']] = button['action']['payload']
Ejemplo n.º 5
0
 def send_msg(self, send_id, message):
     return self.vk_api.messages.send(peer_id=send_id,
                                      message=message,
                                      random_id=random.randint(0, 2048),
                                      keyboard=open(
                                          ConfigLoader.getKeyboard(),
                                          "r",
                                          encoding="UTF-8").read())
Ejemplo n.º 6
0
	def __init__(self):
		#main-window
		builder = Gtk.Builder()
		builder.add_from_file("gui.glade")
		builder.connect_signals(WidgetHandlers(builder));

		Wuohoy.window = builder.get_object("MainWindow")
		Wuohoy.window.connect('delete-event', self.hide)
		ConfigLoader.configure(builder)

		print "main window created"		

		#systray-icon
		self.staticon = Gtk.StatusIcon()
		self.staticon.set_from_stock(Gtk.STOCK_EXECUTE)
		self.staticon.connect('activate', self.activate)
		self.staticon.connect('popup-menu', self.staticon_right_click)
		self.staticon.set_visible(True)
		self.window = None
Ejemplo n.º 7
0
def main():
    qApp = QtWidgets.QApplication(sys.argv)
    backend = Backend()
    configLoader = ConfigLoader()
    window = uis.MainWindow(backend, configLoader)

    backend.register_instrument(vna.Config, vna.Driver)
    configLoader.registerInstrument(vna.Config)
    window.registerInsturmentType(
        "Vna", vna.DataWindow, vna.ConfigWindow,
        QIcon(getResourcePath('images/networkAnalyser.png')),
        vna.Config({
            'model': 'simulated',
            'segments': {
                'TM010': {
                    'type': 'Electric',
                    'f0': 2500700000.0,
                    'span': 1000000.0,
                    'points': 201,
                    'ifbw': 1000.0,
                    'power': 0.0
                }
            }
        }))
    backend.register_instrument(visaScript.Config, visaScript.Driver)
    configLoader.registerInstrument(visaScript.Config)
    window.registerInsturmentType(
        "visaScript", visaScript.DataWindow, visaScript.ConfigWindow,
        QIcon(getResourcePath('images/dcSupply.png')),
        visaScript.Config({'script': 'record_wait()\nlog("Record start")'}))

    backend.register_instrument(datalogger.Config, datalogger.Driver)
    configLoader.registerInstrument(datalogger.Config)
    window.registerInsturmentType(
        "Data Logger", datalogger.DataWindow, datalogger.ConfigWindow,
        QIcon(getResourcePath('images/dcSupply.png')),
        datalogger.Config({'model': '1365'}))
    window.show()

    if (len(sys.argv) > 1):
        window.openConfig(sys.argv[1])

    sys.exit(qApp.exec_())
@app.route("/email/", methods=['POST'])
def email():
	emailHandler = EmailRequestHandler(config)
	response = emailHandler.process(request)
	return response

# For Dev purpose only
@app.route("/test/", methods=['GET'])
def test():
	if app.config["ENV"] == "dev":
		f = open('./test/test.html', 'r')
		content = f.read()
		return Response(content, status=200, mimetype="text/html")
	else:
		return Response("{\"message\": \"Page not allowed to access\"}", status=404)

# Main Service
if __name__ == "__main__":
	config = ConfigLoader()
	if config.isLoaded():
		# get environment
		app.config["ENV"] = config.getEnv()
		print "Environment: "+ app.config["ENV"].upper()
		if app.config["ENV"].lower() == "prod":
			app.run(host= '0.0.0.0')
		elif app.config["ENV"].lower() == "dev":
			app.run(debug=True)
	else:
		print "Failed to load the config. Can't start the Service."
Ejemplo n.º 9
0
import time
from timeloop import Timeloop
from datetime import timedelta
import logging

from webScraper import WebScraper
from configLoader import ConfigLoader

time_loop = Timeloop()


@time_loop.job(interval=timedelta(hours=4, minutes=3, seconds=27))
def updateResumeByTimer():
    ws = WebScraper()
    ws.updateAll()


if __name__ == "__main__":
    logging.basicConfig(
        filename=ConfigLoader.getLogsPath(),
        format='[%(asctime)s] [%(name)s] [%(levelname)s]  %(message)s')
    time_loop.start(block=True)
Ejemplo n.º 10
0
#!/usr/bin/python

# === internal module ===
import threading
import os
# === external module ===
from twisted.internet import reactor
# === project module === 
from configLoader import ConfigLoader
from ui import TtvChatAppUI
from bot import IrcBotFactory


# load ini
print 'loading setting....'
p = ConfigLoader()
settings = p.load('settings.ini')

# init UI thread
print 'preparing UI thread....'
class uiThread(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        self.appUI = TtvChatAppUI(None)
        self.appUI.title('moo Chat')
        self.start()
        
    def run(self):
        print '\n===UI thread online===\n'
        # block here
        self.appUI.mainloop()
	def setUp(self):
		emailService.app.config['TESTING'] = True
		self.app = emailService.app.test_client()
		self.config = ConfigLoader()
		emailService.app.config['ENV'] = self.config.getEnv()
class EmailServiceTestCase(unittest.TestCase):

	def setUp(self):
		emailService.app.config['TESTING'] = True
		self.app = emailService.app.test_client()
		self.config = ConfigLoader()
		emailService.app.config['ENV'] = self.config.getEnv()

	def tearDown(self):
		# nothing to do yet
		pass

	'''
	configLoader.py testing
	'''

	def test_configLoader_getPayloadValidationVersion(self):
		assert self.config.getPayloadValidationVersion()

	def test_configLoader_getPayloadValidationConfig(self):
		assert self.config.getPayloadValidationConfig()

	def test_configLoader_getEmailServiceVersion(self):
		assert self.config.getEmailServiceVersion()

	def test_configLoader_getSplunkLogPath(self):
		assert self.config.getSplunkLogPath()

	def test_configLoader_getLogPath(self):
		assert self.config.getLogPath()

	def test_configLoader_isLoaded(self):
		assert self.config.isLoaded() is True

	def test_configLoader_getEnv(self):
		assert self.config.getEnv() in ('prod', 'dev')

	'''
	emailService.py testing
	'''

	def test_root(self):
		rv = self.app.get('/')
		assert "{\"message\": \"Please check API documentation\"}" in rv.data
		rv = self.app.post('/')
		assert "405 Method Not Allowed" in rv.data
		rv = self.app.put('/')
		assert "405 Method Not Allowed" in rv.data
		rv = self.app.delete('/')
		assert "405 Method Not Allowed" in rv.data

	def test_test(self):
		emailService.app.config['ENV'] = "prod"
		if emailService.app.config['ENV'] is "prod":
			rv = self.app.get('/test/')
			assert "{\"message\": \"Page not allowed to access\"}" in rv.data
			rv = self.app.post('/test/')
			assert "405 Method Not Allowed" in rv.data
			rv = self.app.put('/test/')
			assert "405 Method Not Allowed" in rv.data
			rv = self.app.delete('/test/')
			assert "405 Method Not Allowed" in rv.data
		emailService.app.config['ENV'] = "dev"
		if emailService.app.config['ENV'] is "dev":
			rv = self.app.get('/test/')
			assert "<p>Just for testing</p>" in rv.data
			rv = self.app.post('/test/')
			assert "405 Method Not Allowed" in rv.data
			rv = self.app.put('/test/')
			assert "405 Method Not Allowed" in rv.data
			rv = self.app.delete('/test/')
			assert "405 Method Not Allowed" in rv.data

	def test_email(self):
		pass

	'''
	emailRequestHandler.py testing
	'''

	def test_email_request_handler(self):
		pass

	'''
	payloadValidationHelper.py testing
	'''

	def test_payload_validation_helper(self):
		pass

	'''
	providerRequestHandler.py testing
	'''

	def test_provider_request_handler(self):
		pass
Ejemplo n.º 13
0
 def commandFromList(cls):
     file_str = open(ConfigLoader.getCommands(), "r",
                     encoding="UTF-8").read()
     data = json.loads(file_str)
     for command in data['user']:
         cls.m_command_map[command['label']] = command['synonyms']