<commit_before># coding=utf-8

import sys
import uuid

def refresh_plex_token():
    username = Prefs["plex_username"]
    password = Prefs["<PASSWORD>"]

    if not username or not password:
	if "token" in Dict:
	    del Dict["token"]
	    Dict.Save()
	return

    if not "uuid" in Dict:
	Dict["uuid"] = uuid.uuid1()
	Dict.Save()

    current_uuid = Dict["uuid"]

    headers = {
               'X-Plex-Device-Name': 'Sub-Zero',
               'X-Plex-Product': 'Sub-Zero',
               'X-Plex-Version': '1.3.0',
               'X-Plex-Client-Identifier': "%s" % current_uuid,
               }

    request = HTTP.Request("https://plex.tv/users/sign_in.json", headers=headers, values={'user[login]': Prefs["plex_username"], 'user[password]': Prefs["<PASSWORD>"]}, immediate=True)
    token = None
    if request:
	try:
    	    data = JSON.ObjectFromString(request.content)
	    token = data["user"]["authentication_token"]
	    Log.Debug("Data returned from plex.tv: %s", data)
	except:
	    pass
	if token:
	    Dict["token"] = token
	    Dict.Save()
	    return True

<commit_msg>hide plex token from logs; fixes #64<commit_after># coding=utf-8

import sys
import uuid

def refresh_plex_token():
    username = Prefs["plex_username"]
    password = Prefs["<PASSWORD>"]

    if not username or not password:
	if "token" in Dict:
	    del Dict["token"]
	    Dict.Save()
	return

    if not "uuid" in Dict:
	Dict["uuid"] = uuid.uuid1()
	Dict.Save()

    current_uuid = Dict["uuid"]

    headers = {
               'X-Plex-Device-Name': 'Sub-Zero',
               'X-Plex-Product': 'Sub-Zero',
               'X-Plex-Version': '1.3.0',
               'X-Plex-Client-Identifier': "%s" % current_uuid,
               }

    request = HTTP.Request("https://plex.tv/users/sign_in.json", headers=headers, values={'user[login]': Prefs["plex_username"], 'user[password]': Prefs["plex_password"]}, immediate=True)
    token = None
    if request:
	try:
    	    data = JSON.ObjectFromString(request.content)
	    token = data["user"]["authentication_token"]
	    log_data = data.copy()
	    log_data["user"]["authentication_token"] = "<KEY>"
	    Log.Debug("Data returned from plex.tv: %s", log_data)
	except:
	    pass
	if token:
	    Dict["token"] = token
	    Dict.Save()
	    return True


{'fraction_non_alphanumeric': 0.1577797202797203, 'fraction_numerical': 0.005244755244755245, 'mean_word_length': 2.715909090909091, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '1437093', 'n_tokens_mistral': 800, 'n_tokens_neox': 761, 'n_words': 166}