<commit_before>"""
Class for moving data to Solr 
"""
from django.conf import settings

import platform
import urllib
import string
import json
import urllib.request
import numpy as np
import random
import string

class corona:
	solrServer = settings.SOLR_EC2

	inst = None
	def __init__(self): 
		pass

	def ping (self):
		url = self.solrServer + "select?q=*%3A*&wt=json&indent=true"
		try:
			f = urllib.request.urlopen(url)
			if f.getcode() == 200:
				return True
			else:
				print (req)
				return False
		except Exception as e:
			print (e)
			print (req.encode('utf-8'))
	"""<commit_msg>added ec2 config to corona<commit_after>"""
Class for moving data to Solr 
"""
from django.conf import settings

import platform
import urllib
import string
import json
import urllib.request
import numpy as np
import random
import string

class corona:

	# TODO pull from Heroku ENV var
	HEROKU = bool(os.environ.get('ON_HEROKU', ''))
	if HEROKU:
		api_key = os.environ['SOLR_EC2']
	if not HEROKU:
		api_key = settings.API_KEYS['WALTERS_API_KEY']

	solrServer = settings.SOLR_EC2

	inst = None
	def __init__(self): 
		pass

	def ping (self):
		url = self.solrServer + "select?q=*%3A*&wt=json&indent=true"
		try:
			f = urllib.request.urlopen(url)
			if f.getcode() == 200:
				return True
			else:
				print (req)
				return False
		except Exception as e:
			print (e)
			print (req.encode('utf-8'))
	"""
{'fraction_non_alphanumeric': 0.11071428571428571, 'fraction_numerical': 0.01, 'mean_word_length': 3.7491525423728813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '1851106', 'n_tokens_mistral': 576, 'n_tokens_neox': 508, 'n_words': 151}