예제 #1
0
def main():
    usage = _("torrent_download [options]")
    parser = optparse.OptionParser(version="diffsamizdat %s" % __version__,
                                   usage=usage)
    parser.add_option('-d',
                      '--debug',
                      dest='debug_mode',
                      action='store_true',
                      help=_('Print the maximum debugging info (implies -vv)'))
    parser.add_option(
        '-v',
        '--verbose',
        dest='logging_level',
        action='count',
        help=_('set error_level output to warning, info, and then debug'))

    parser.set_defaults(logging_level=0)
    (options, args) = parser.parse_args()
    # set the verbosity
    if options.debug_mode:
        options.logging_level = 3
    logging.basicConfig(
        level=LEVELS[options.logging_level],
        format='%(lineno)d %(asctime)s %(levelname)s %(message)s')
    config.load()
    t = TorrentCheck()
    return
예제 #2
0
    def test_load_FileMissesGroupServerUrl_RaisesMissingParameterError(
            self, tmp_file):

        tmp_file.write("""{
            "proxy_server_url": "proxy.com",
            "group_server_pubkey_path": "group/key",
            "main_server_pubkey_path": "main/key",
            "user_key_path": "user/key",
            "user_email": "*****@*****.**"
        }""")

        with raises(MissingParameterError):
            config.load(str(tmp_file))
예제 #3
0
def main():
	usage = _("torrent_download [options]")
	parser = optparse.OptionParser(version="diffsamizdat %s" % __version__, usage=usage)
	parser.add_option('-d', '--debug', dest='debug_mode', action='store_true',
	help=_('Print the maximum debugging info (implies -vv)'))
	parser.add_option('-v', '--verbose', dest='logging_level', action='count',
		help=_('set error_level output to warning, info, and then debug'))
	
	parser.set_defaults(logging_level=0)
	(options, args) = parser.parse_args()
	# set the verbosity
	if options.debug_mode:
		options.logging_level = 3
	logging.basicConfig(level=LEVELS[options.logging_level], format='%(lineno)d %(asctime)s %(levelname)s %(message)s')
	config.load()
	t = TorrentCheck()
	return 
예제 #4
0
    def test_load_FileWithAllParameters_LoadedParametersMatchFile(
            self, tmp_file):
        tmp_file.write("""{
            "group_server_url": "group.com",
            "proxy_server_url": "proxy.com",
            "group_server_pubkey_path": "group/key",
            "main_server_pubkey_path": "main/key",
            "user_key_path": "user/key",
            "user_email": "*****@*****.**"
        }""")

        config.load(str(tmp_file))

        assert config.group_server_url == "group.com"
        assert config.proxy_server_url == "proxy.com"
        assert config.group_server_pubkey_path == "group/key"
        assert config.main_server_pubkey_path == "main/key"
        assert config.user_key_path == "user/key"
        assert config.user_email == "*****@*****.**"
예제 #5
0
def main():
    app = QApplication(sys.argv)

    if len(sys.argv) > 1:
        config.app_dir = sys.argv[1]

    if os.path.exists(config.config_path):
        # User is already registered

        config.load()

        dialog = LoginDialog()

        if dialog.exec() != 1:
            print("Error: failed to login user\n"
                  "Will exit the program!",
                  file=sys.stderr)
            sys.exit(1)

        # Get registered client
        client = dialog.client

    else:
        # User needs to register first

        # Present the user with the register dialog
        dialog = RegisterDialog()

        if dialog.exec() != 1:
            print("Error: failed to register user\n"
                  "Will exit the program!",
                  file=sys.stderr)
            sys.exit(1)

        # Get registered client
        client = dialog.client

    window = MainWindow(client)
    window.refresh()
    window.adjustSize()
    window.show()
    sys.exit(app.exec_())
예제 #6
0
import logging
from os import getenv
from traceback import format_exc

from flask.views import MethodView
from flask import (Flask,
                   jsonify,
                   make_response,
                   request)

from configuration.config import load
load()
from eyechecker.utils.validation import validate_params
from eyechecker.utils.command import Command
from eyechecker.utils.schemas import (patientschema, doctorschema)

application = Flask(__name__)


if getenv('ENV_SELECTOR') == 'development':
    logging.info('Disabling cross-origin checking')
    from flask_cors import CORS
    CORS(application)


@application.route('/')
def root():
    return make_response(
        jsonify(
            {'status': 'ok'}), 200)