<commit_before>#!/usr/bin/env python

import sys
import os
import requests



class RestError(Exception):
        def __init__(self):
                self.value = "UNKNOWN ERROR"

        def __init__(self, value):
                if value == None:
                        value = "UNKNOWN ERROR"
                self.value = value

        def __str__(self):
                return repr(self.value)


class RestClient():
	
	def __init__(self, format="json", good_status_codes=[200,201], ssl_verify=True):
		self.format = format
		self.good_status_codes = good_status_codes
		self.ssl_verify = ssl_verify

	def get(self, url):
		result = None
		try:
			response = requests.get(url, verify=self.ssl_verify)
		except requests.exceptions.ConnectionError as e:
			raise RestError("cannot connect to: %s" % url), None, sys.exc_info()[2]
		except Exception as e:
			raise RestError(), None, sys.exc_info()[2]

		if response.status_code not in self.good_status_codes:
			raise RestError("bad status code: %s" % response.status_code)<commit_msg>bad request behaviour improved /BB<commit_after>#!/usr/bin/env python

import sys
import os
import requests



class RestError(Exception):
        def __init__(self):
                self.value = "UNKNOWN ERROR"

        def __init__(self, value):
                if value == None:
                        value = "UNKNOWN ERROR"
                self.value = value

        def __str__(self):
                return repr(self.value)


class RestClient():
	
	def __init__(self, format="json", good_status_codes=[200,201], ssl_verify=True):
		self.format = format
		self.good_status_codes = good_status_codes
		self.ssl_verify = ssl_verify

	def get(self, url):
		result = None
		try:
			response = requests.get(url, verify=self.ssl_verify)
		except requests.exceptions.ConnectionError as e:
			raise RestError("cannot connect to: %s" % url), None, sys.exc_info()[2]
		except Exception as e:
			raise RestError(), None, sys.exc_info()[2]

		if response.status_code not in self.good_status_codes:
			raise RestError("bad status code: %s - %s" % (response.status_code, response.reason) )
{'fraction_non_alphanumeric': 0.10707547169811321, 'fraction_numerical': 0.007547169811320755, 'mean_word_length': 2.9132841328413286, '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': '7456430', 'n_tokens_mistral': 701, 'n_tokens_neox': 629, 'n_words': 171}