コード例 #1
0
def main():
    global browser, data

    if len(sys.argv) > 1 and sys.argv[1] == "--reset":
        data = load_credentials(reset=True)
    else:
        data = load_credentials()
    if data.get("joinMeetingInBackground"):
        opt.add_argument("headless")

    browser = webdriver.Chrome(ChromeDriverManager().install(), options=opt)

    step = 0
    while step != 2:
        step = init(step)
    else:
        while True:
            try:
                checkAndEndOrLeaveOrJoinMeeting()
            except:
                print('join meeting failed, trying again')
                browser.get('https://teams.microsoft.com/_#/calendarv2'
                            )  # open calendar tab in teams
            else:
                sleep(3)
コード例 #2
0
def lambda_handler(event, context):
    '''Demonstrates a simple HTTP endpoint using API Gateway. You have full
    access to the request and response payload, including headers and
    status code.

    To scan a DynamoDB table, make a GET request with the TableName as a
    query string parameter. To put, update, or delete an item, make a POST,
    PUT, or DELETE request respectively, passing in the payload to the
    DynamoDB API as a JSON body.
    '''
    print("Received event: " + json.dumps(event, indent=2))
    credentials = load_credentials(['bot_token'])
    bot = BotPoster(credentials['bot_token'])

    operation = event['httpMethod']
    if operation == 'POST':
        body = json.loads(event['body'])
        print(body['type'])
        if body['type'] == 'url_verification':
            print(body)
            return respond(False, res={'challenge': body['challenge']})

        bot.process_message(body['event'])
        return respond(False, res='Message Posted!')
    if operation == 'GET':
        return respond(False, 'gotcha.')
    else:
        return respond(ValueError('Unsupported method "{}"'.format(operation)))
コード例 #3
0
ファイル: slack.py プロジェクト: kousuke-takeuchi/trading
def post_slack(message):
    credentials = load_credentials()
    url = credentials.get('SLACK_WEBHOOK_URL')
    payload = {
        'channel': '#report',
        'username': '******',
        'text': message,
        'icon_emoji': ':robot_face:'
    }
    requests.post(url, data=json.dumps(payload))
コード例 #4
0
def provider_factory(provider_name, providers=None, credentials=None):
    if providers is None:
        cfme_data = load_cfme_data()
        providers = cfme_data['management_systems']

    provider = providers[provider_name]

    if credentials is None:
        credentials_dict = load_credentials()
        credentials = credentials_dict[provider['credentials']]

    # Munge together provider dict and creds,
    # Let the provider do whatever they need with them
    provider_kwargs = provider.copy()
    provider_kwargs.update(credentials)
    provider_instance = provider_type_map[provider['type']](**provider_kwargs)
    return provider_instance
コード例 #5
0
ファイル: providers.py プロジェクト: jwadkins/cfme_tests
def provider_factory(provider_name, providers=None, credentials=None):
    if providers is None:
        cfme_data = load_cfme_data()
        providers = cfme_data['management_systems']

    provider = providers[provider_name]

    if credentials is None:
        credentials_dict = load_credentials()
        credentials = credentials_dict[provider['credentials']]

    # Munge together provider dict and creds,
    # Let the provider do whatever they need with them
    provider_kwargs = provider.copy()
    provider_kwargs.update(credentials)
    provider_instance = provider_type_map[provider['type']](**provider_kwargs)
    return provider_instance
コード例 #6
0
ファイル: providers.py プロジェクト: bcrochet/cfme_tests
def provider_factory(provider_name, providers=None, credentials=None):
    if providers is None:
        cfme_data = load_cfme_data()
        providers = cfme_data['management_systems']

    provider = providers[provider_name]

    if credentials is None:
        credentials_dict = load_credentials()
        credentials = credentials_dict[provider['credentials']]

    provider_instance = provider_type_map[provider['type']](
        provider['ipaddress'],
        credentials['username'],
        credentials['password']
    )

    return provider_instance
コード例 #7
0
ファイル: daddyBot.py プロジェクト: gsireesh/slackbot
from flask import Flask, request
from credentials import load_credentials
from bot_poster import BotPoster

app = Flask(__name__)
credentials = load_credentials(['bot_token'], 'credentials.json')
bot = BotPoster(credentials['bot_token'])


@app.route('/message', methods=['POST'])
def respond_to_message():
    body = request.get_json()
    bot.process_message(body)
    return 'Message posted!'


app.run()