<commit_before><commit_msg>Initial version of publish app script<commit_after>#!/usr/bin/env python
# Helper script to publish sample message to SQS queue
import yaml
import boto3
import sys

if len(sys.argv) < 2:
	print 'usage: publish-application.py {filename}}'
	sys.exit(1)

# Load config file
config = None
with open("config.yml", "r") as stream:
	try:
		config = list(yaml.load_all(stream))[0]
	except yaml.YAMLError as ex:
		print(ex)
		sys.exit(1)

# Variables
filename = sys.argv[1]
sqs_url = config['sqs_url']

print ('Sending to [%s] from filename: %s' %(sqs_url, filename))

with open(filename, 'r') as applicationfile:
    data=applicationfile.read().replace('\n', '')

session = boto3.Session(profile_name='default')
client = session.client('sqs').send_message(
    QueueUrl=sqs_url,
    MessageBody=data,
    MessageAttributes={
        'string': {
            'StringValue': 'string',
            'DataType': 'String'
        }
    }
)
{'fraction_non_alphanumeric': 0.14300736067297581, 'fraction_numerical': 0.007360672975814932, 'mean_word_length': 4.010526315789473, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5623977', 'n_tokens_mistral': 334, 'n_tokens_neox': 323, 'n_words': 81}