<commit_before>import urllib2
import urllib
import json
import re
from cookielib import CookieJar

def call(method, params):
    baseUrl = 'https://ivle.nus.edu.sg/api/Lapi.svc/'
    url = '%s?%s' % (baseUrl + method, urllib.urlencode(params))
    result = urllib2.urlopen(url).read()
    return result
<commit_msg>updated api.call to return better results<commit_after>import urllib2
import urllib
import json
import re
from cookielib import CookieJar

def call(method, params):
    baseUrl = 'https://ivle.nus.edu.sg/api/Lapi.svc/'
    url = '%s?%s' % (baseUrl + method, urllib.urlencode(params))
    jsonString = urllib2.urlopen(url).read()
    results = json.loads(jsonString)['Results'] # TODO: is this the standard locaton for results?
    return [i for i in results]

{'fraction_non_alphanumeric': 0.12403100775193798, 'fraction_numerical': 0.00516795865633075, 'mean_word_length': 4.236486486486487, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5780231', 'n_tokens_mistral': 273, 'n_tokens_neox': 271, 'n_words': 71}