<commit_before>#! python3
# Copyright 2017 <NAME>
#
# This contains the main functions

# built-in libs
import os, argparse
from os.path import join, dirname

# installed libs
from robobrowser import RoboBrowser # pip install robobrowser
from twilio.rest import Client # pip install twilio
from twilio.base.exceptions import TwilioRestException
from dotenv import load_dotenv # pip install -U python-dotenv

###from base64 import b64decode, b64encode
import pdb

# Globals
VERBOSE = False
PROFILE_URL = "http://rock.newspring.cc/Person/"
LOGIN_URL = "https://rock.newspring.cc"
USER_FIELD_ID = "ctl17$ctl01$ctl00$tbUserName"
PW_FIELD_ID = "<PASSWORD>"
LOGIN_BTN_ID = "ctl17$ctl01$ctl00$btnLogin"
SEARCH_URL = "https://rock.newspring.cc/Person/Search/name/?SearchTerm="
PEOPLE_TBL_ID = "ctl00_main_ctl09_ctl01_ctl00_gPeople"

def _main(query = "", to = None):
	"""
	Will get the contact info and send back to user.
	"""

	msg = search(query)
	if to: _sendMessage(to, msg)
	return msg

def _login(user = "", pw = ""):
	"""
	Will login using given credentials to Rock.
	"""

	loginPage = (LOGIN_URL)

	# testing robobrowser
	browser = RoboBrowser(history = True, parser = "lxml")
	browser.open(loginPage)
	form = browser.get_forms()[0]
	form[USER_FIELD_ID].value = user
	form[PW_FIELD_ID].value = pw
	submitBtn = LOGIN_BTN_ID
	browser.submit_form(form, submit = form[submitBtn])
	
	return browser
<commit_msg>fixed user and password field IDs<commit_after>#! python3
# Copyright 2017 Michael Neeley
#
# This contains the main functions

# built-in libs
import os, argparse
from os.path import join, dirname

# installed libs
from robobrowser import RoboBrowser # pip install robobrowser
from twilio.rest import Client # pip install twilio
from twilio.base.exceptions import TwilioRestException
from dotenv import load_dotenv # pip install -U python-dotenv

###from base64 import b64decode, b64encode
import pdb

# Globals
VERBOSE = False
PROFILE_URL = "http://rock.newspring.cc/Person/"
LOGIN_URL = "https://rock.newspring.cc/page/3"
USER_FIELD_ID = "ctl11$ctl01$ctl00$tbUserName"
PW_FIELD_ID = "<PASSWORD>"
LOGIN_BTN_ID = "ctl11$ctl01$ctl00$btnLogin"
SEARCH_URL = "https://rock.newspring.cc/Person/Search/name/?SearchTerm="
PEOPLE_TBL_ID = "ctl00_main_ctl09_ctl01_ctl00_gPeople"

def _main(query = "", to = None):
	"""
	Will get the contact info and send back to user.
	"""

	msg = search(query)
	if to: _sendMessage(to, msg)
	return msg

def _login(user = "", pw = ""):
	"""
	Will login using given credentials to Rock.
	"""

	loginPage = (LOGIN_URL)

	# testing robobrowser
	browser = RoboBrowser(history = True, parser = "lxml")
	browser.open(loginPage)
	form = browser.get_forms()[0]
	
	#TODO: dynamically find user field ID and pw ID
	form[USER_FIELD_ID].value = user
	form[PW_FIELD_ID].value = pw
	submitBtn = LOGIN_BTN_ID
	browser.submit_form(form, submit = form[submitBtn])
	
	return browser

{'fraction_non_alphanumeric': 0.10973084886128365, 'fraction_numerical': 0.022429261559696344, 'mean_word_length': 5.077568134171908, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '558189', 'n_tokens_mistral': 1068, 'n_tokens_neox': 1011, 'n_words': 269}