<commit_before>import os
import pycurl
import json
import configparser
import pprint

def getAppListAndMetadata():
	with open('../input/UPIAppList.tsv','r') as f:
		for line in f.readlines():
			getMetadata(line.split('\t')[0].split('=')[1], line.split('\t')[1])

def main():
	#getAppListAndMetadata()
	#ParseUsableMetadata()
	PermissionListExtractor()
	#UpdateGoogleSheets()

def PermissionListExtractor():
	for filename in os.listdir('../output/'):
		print filename
		with open('../output/'+filename) as f:
			data = json.loads(f.read())
			#print data['content']
			pprint(data['content']["developer"]["name"])
			pprint(data['content']["ratings"]["average"])

def getMetadata(application_id,application_name):
	print 'Get metadata using AppTweak'
	apptweak_base_url = 'https://api.apptweak.com/android/applications/'
	request_suffix = '.json?country=in&language=en'

	request_url = apptweak_base_url + application_id + request_suffix
	config = configparser.ConfigParser()
	config.read('config.ini')
	APPTWEAK_API_KEY = config.get('DEFAULT','APPTWEAK_API_KEY')
	c = pycurl.Curl()

	with open('../output/' + application_name + '.json', 'w') as f:<commit_msg>Fix created filename<commit_after>import os
import pycurl
import json
import configparser
import pprint

def getAppListAndMetadata():
	with open('../input/UPIAppList.tsv','r') as f:
		for line in f.readlines():
			getMetadata(line.split('\t')[0].split('=')[1], line.split('\t')[1].split('\n'))

def main():
	#getAppListAndMetadata()
	#ParseUsableMetadata()
	PermissionListExtractor()
	#UpdateGoogleSheets()

def PermissionListExtractor():
	for filename in os.listdir('../output/'):
		print filename
		with open('../output/'+filename) as f:
			data = json.loads(f.read())
			#print data['content']
			pprint(data['content']["developer"]["name"])
			pprint(data['content']["ratings"]["average"])

def getMetadata(application_id,application_name):
	print 'Get metadata using AppTweak'
	apptweak_base_url = 'https://api.apptweak.com/android/applications/'
	request_suffix = '.json?country=in&language=en'

	request_url = apptweak_base_url + application_id + request_suffix
	config = configparser.ConfigParser()
	config.read('config.ini')
	APPTWEAK_API_KEY = config.get('DEFAULT','APPTWEAK_API_KEY')
	c = pycurl.Curl()

	with open('../output/' + application_name + '.json', 'w') as f:
{'fraction_non_alphanumeric': 0.16930312099187686, 'fraction_numerical': 0.0025651988029072254, 'mean_word_length': 5.902654867256637, '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': '6702584', 'n_tokens_mistral': 831, 'n_tokens_neox': 801, 'n_words': 151}