<commit_before># encoding: utf-8

import sys
from workflow import Workflow, ICON_WEB, ICON_ERROR, web

def format_strings_from_quote(ticker, quote_data):
    usd_query = 'USDT_' + ticker.upper()
    last = '%.2f' % float(quote_data[usd_query]['last'])
    high = '%.2f' % float(quote_data[usd_query]['high24hr'])
    low = '%.2f' % float(quote_data[usd_query]['low24hr'])
    formatted = {}
    formatted['title'] = ticker.upper() + ': $' + last
    formatted['subtitle'] = '24hr High: ' + high + ' 24hr low ' + low
    return formatted

def main(wf):
    # Get query from Alfred
    if len(wf.args):
        query = wf.args[0]
    else:
        query = None

    url = 'https://poloniex.com/public?command=returnTicker'
    r = web.get(url)

    # throw an error if request failed
    # Workflow will catch this and show it to the user
    r.raise_for_status()

    # Parse the JSON returned by pinboard and extract the posts
    result = r.json()
    if query:
        usd_query = 'USDT_' + query.upper()
        usd_link = 'https://poloniex.com/exchange#' + usd_query
        if usd_query in result:
            formatted = format_strings_from_quote(query, result)
            wf.add_item(title=formatted['title'],
                        subtitle=formatted['subtitle'],
                        arg=usd_link,
                        valid=True,<commit_msg>Remove comment.<commit_after># encoding: utf-8

import sys
from workflow import Workflow, ICON_WEB, ICON_ERROR, web

def format_strings_from_quote(ticker, quote_data):
    usd_query = 'USDT_' + ticker.upper()
    last = '%.2f' % float(quote_data[usd_query]['last'])
    high = '%.2f' % float(quote_data[usd_query]['high24hr'])
    low = '%.2f' % float(quote_data[usd_query]['low24hr'])
    formatted = {}
    formatted['title'] = ticker.upper() + ': $' + last
    formatted['subtitle'] = '24hr High: ' + high + ' 24hr low ' + low
    return formatted

def main(wf):
    # Get query from Alfred
    if len(wf.args):
        query = wf.args[0]
    else:
        query = None

    url = 'https://poloniex.com/public?command=returnTicker'
    r = web.get(url)

    # throw an error if request failed
    # Workflow will catch this and show it to the user
    r.raise_for_status()

    result = r.json()
    if query:
        usd_query = 'USDT_' + query.upper()
        usd_link = 'https://poloniex.com/exchange#' + usd_query
        if usd_query in result:
            formatted = format_strings_from_quote(query, result)
            wf.add_item(title=formatted['title'],
                        subtitle=formatted['subtitle'],
                        arg=usd_link,
                        valid=True,
{'fraction_non_alphanumeric': 0.12876506024096385, 'fraction_numerical': 0.009789156626506024, 'mean_word_length': 2.5616621983914207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '1827270', 'n_tokens_mistral': 910, 'n_tokens_neox': 875, 'n_words': 200}