Read .js generated values on a site

I know, I know - It sounds very boring. So if you don't need to do something like it says in the title, don't continue reading.\n\nIf you do! Welcome to my world!\n\nSee the following python script. It's reading the bitstamp website for the latest price:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from selenium import webdriver 
from selenium.common.exceptions import TimeoutException
from import WebDriverWait 
from import expected_conditions as EC 
from bs4 import BeautifulSoup
import csv
import datetime

now =
d = ; t = now.time()

# Create a dictionary of text wallets
filename = "wallets.csv"
reader = csv.reader(open(filename, 'rU'), dialect='excel')

# header = ; print header
for rows in reader:
wallet = dict((rows[0],rows[1]) for rows in reader)    

# create a list to extract the balance of each wallet
balancelist = []
driver = webdriver.Firefox() #; driver.get(wallet)  

# Run through each wallet and put that balance in the balance list
for w in wallet.values():
findbalance = driver.find_element_by_id("final_balance")
btcbal = findbalance.get_attribute("innerHTML")
btcpriceclean = BeautifulSoup(btcbal)
cleaned = str(''.join(btcpriceclean.findAll(text=True))[:-3].replace(",", ""))

#This uses a filename that contains the bitcoin price from various exchanges
#And import a dictionary. Note the 'as inf' bit 
filename = "bitcoin.price"
with open(filename,'r') as inf:
dict_from_file = eval(
tx = dict_from_file

# The extracts the prices from the imported dictionary
price = []
prices = tx.values()
for p in tx.values():

# This floats the 2nd price in the dictionary to be used for approximation of
# BTC balance value
spot = 1
y = float(price[spot])
dictionary = dict(zip(wallet.keys(),balancelist))

#This runs through the values of each wallet balance
for key, value in dictionary.iteritems():
print "%s's Balance is\t BTC %s \tApprox value: $%r" % (key, value, round(y * float(value),2))
a = tx.keys()[spot]

# This lets you know what exchange and price was used for the approx
print "\nApprox based on %s @ $%s" % (a, y)

P.S. I know some of the imports are not needed, but they will be used when the script fills out some more