Example #1
0
def main(fail_on_major, fail_on_minor, fail_on_patch):
    # Set logging
    logging.basicConfig(format='%(levelname)s: %(message)s', level=log_level)

    # Load images from compose file specified
    images = load_compose(compose_file)

    # Loop to check image by image
    for image in images:
        logging.info("Checking if {} is the latest version...".format(image))

        # Parse out image information
        org, repo, version = parse_image(image)

        # Generate token to authenticate call to registry
        token = authenticate(registry_username, registry_password, org, repo,
                             registry_auth_domain, registry_auth_service,
                             registry_api_domain)

        # Get the full list of versions from the tag list
        versions = get_tags(org, repo, registry_api_domain, token)

        # Parse the versions and see if a newer one exists
        parse_versions(version, versions, fail_on_major, fail_on_minor,
                       fail_on_patch)
def main():
    reddit_object = authenticate()
    configured_processor = functools.partial(reply_function,
                                             api_input=api(),
                                             reddit_object_input=reddit_object)
    # map reply to list of comments, and use your partials to simplify your parameters.
    list(
        map(lambda x: configured_processor(comment_id_input=x),
            list_creator(reddit_object)))
Example #3
0
    def wrap_f(self, *args, **kwargs):
        auth_header = self.request.headers.get('Authorization', None)
        auth_user = None
        if((auth_header != None) and (auth_header.startswith('Basic'))):
            (user, passwd) = base64.decodestring(auth_header[6:]).split(':', 2)
            auth_user = self.USER = authenticator.authenticate(user, passwd)

        if(auth_user == None):
            self.set_header('WWW-Authenticate', 'Basic realm=rabbitornado')
            self.set_header('Location', '/')
            self.set_status(401)
            self.write('Login needed')
            self.finish()
            return False

        return f(self, *args, **kwargs)
Example #4
0
def sign_in():
    error = False

    if 'token' in session:
        return redirect(url_for('overview'))

    if request.method == 'POST':
        # we got some request, let's see if we can authenticate that user
        username = request.form['username']
        password = request.form['password']

        if authenticator.authenticate(username, password):

            return redirect(url_for('overview'))
        else:
            error = True

    return render_template('sign_in.html', error=error)
Example #5
0
from Common import *
from log import *
from new_Common import *
import time
from authenticator import authenticate
import functools
import new_scripture_bot
import functools

api_key = new_scripture_bot.api()

print(api_key)

reddit_object = authenticate()
print(reddit_object)

comment_list = new_scripture_bot.list_creator(reddit_object)

print(comment_list)
import praw
import authenticator
from authenticator import authenticate
'''
def authenticate():
    reddit_instance = praw.Reddit(client_id='FUlMD-cKILpnUA',
                                  client_secret='bkZH3og2C2x8_IpqDD-mFCTOseA',
                                  password='******',
                                  user_agent='scripture_bot',
                                  username='******')
    return reddit_instance
'''

scripture_bot_object = authenticate()

print(scripture_bot_object.user.me())

print('the reddit bot object is ' + str(scripture_bot_object))
'''
unread_messages = scripture_bot.unread_generator(scripture_bot_object)

print('the unread message object is '+str(unread_messages))
'''
unread = scripture_bot_object.inbox.unread(limit=None)
for i in unread:
    print(i.body)
for i in scripture_bot_object.inbox.unread(limit=None):
    print(i.body)
    print(i.author)
    print(i.fullname)
'''
Example #7
0
#Graham Wood
#This file contains most of the functions for tweeting
#tweets, though it can only really be used as an extention of main

#Not sure if this is needed, considering these functions will only
#be called from main, but here it is anyway
import tweepy
import authenticator
import time

api = authenticator.authenticate()

#takes in a string and tweets it immediately
def tweetInput (string):
	api.update_status(string)

#takes in a string and a number of seconds, will wait that long and then tweet
def timedTweet (string, seconds):
	time.sleep(seconds)
	tweetInput(string)

import tweepy
import authenticator as auth
import json
import time
from os.path import join

api = tweepy.API(auth.authenticate(),
                 wait_on_rate_limit=True,
                 wait_on_rate_limit_notify=True)
cursor = tweepy.Cursor(api.search,
                       q='Star Trek',
                       rpp=50,
                       lang='en',
                       result_typr='recent',
                       include_entities=True).items()
jsonDir = 'tngTweets'


def now():
    return int(round(time.time()))


def checkRls():
    """Checks rate_limit_status of Twitter Search API and returns its value."""
    return api.rate_limit_status(
    )['resources']['search']['/search/tweets']['remaining']


def writeTweets(cursor):
    # tweets = [tweet._json for tweet in cursor].sort(key=lambda x: x["id"])
    count = 1
Example #9
0
    def on_close(ws):
        logger.info(f'{ws} connection closed.')

    def on_open(ws):
        logger.info(f'{ws} connection opened.')

    def on_error(ws, error):
        logger.info(error)

    def on_message(ws, message):
        logger.info(message)


    # Define pair.
    pair = 'ETHUSD'

    # Define filter.
    filtering = ''
    usefilter = True
    if usefilter: filtering = 'trades=true'

    # Construct payload.
    request = resourcelocator.sockgenuine + '/v1/marketdata/' + pair + '?' + filtering
    nonce = int(time.time() * 1000)
    payload = {'request': request, 'nonce': nonce}
    authenticate(payload)

    # Establish websocket connection.
    ws = websocket.WebSocketApp(request, on_message=on_message)
    ws.run_forever(sslopt={'cert_reqs': ssl.CERT_NONE})
def authenticate():
    global file_write_data

    # URL that the information is stored at
    reg_data_url = "http://pastebin.com/raw.php?i=PER0wCBM"

    try:
        # Request the URL, and retrieve the info on that page, in this case it is raw text, save it as reg_data.xml
        urllib.request.urlretrieve(reg_data_url, REG_FILE_DIR)
        reg_file_exits = True
    except HTTPError:
        authenticator.contact_error()
        reg_file_exits = False
    except URLError:
        authenticator.contact_error()
        reg_file_exits = False

    if reg_file_exits:
        # Get the authenticator to authenticate the entered reg key
        authenticator.authenticate()

    # Pre-define the index array (list) variable that will store data for the user
    match_data = [None, None, None, None, None]

    # If it returns False, remove the reg_data.xml file, then return False to the place in which it was run.
    if authenticator.get_match_data() is False:
        if reg_file_exits:
            remove(REG_FILE_DIR)
        return False
    # If get_match_data returns anything else, it should be user information
    else:
        # Extract the data from match_data_received from a tuple to a list, as it should be formatted
        match_data[0], match_data[1], match_data[2], match_data[3], match_data[
            4] = authenticator.get_match_data()

        # In index 4, the code for a logo should be stored, set logo_code to that URL
        logo_code = str(match_data[4])

        try:
            # Request and retrieve the logo from the url and store it as logo.png
            urllib.request.urlretrieve(str(LOGO_BASE_URL + logo_code + ".png"),
                                       LOGO_FILE_DIR)
        except HTTPError:
            authenticator.contact_error()
        except URLError:
            authenticator.contact_error()

        # Request a string to be encoded as an MD5 (Hex Digest), store it in encoded_result
        encode_string_general.EncodeString(
            match_data[3] + registry.get_reg_value(registry.HKEY_CURRENT_USER,
                                                   REG_DIR, "reg_key"))

        encoded_result = str(
            encode_string_general.get_encoded_string_variable())

        # Set the file_write_data to a format of the data that has been retrieved, excluding the image url
        file_write_data = format(
            "%s\n"
            "%s\n"
            "%s" % (encoded_result, match_data[1], match_data[2]))

        if reg_file_exits:
            # Remove the reg_info.xml file as there is no longer any need for it
            remove(REG_FILE_DIR)

        # Return true to the place in which this function was called (marking this as a successful validation)
        return True