<commit_before>#!/usr/bin/python
import json
import urllib2

from bs4 import BeautifulSoup
from datetime import datetime


def chaco():
    try:
        soup = BeautifulSoup(
            urllib2.urlopen('http://www.cambioschaco.com.py/php/imprimir_.php').read(), "html.parser")
        compra = soup.find_all('tr')[3].contents[5].string[:5].replace('.', '')
        venta = soup.find_all('tr')[3].contents[7].string[:5].replace('.', '')
    except urllib2.URLError:
        compra, venta = 0, 0

    return int(compra), int(venta)


def maxi():
    try:
        soup = BeautifulSoup(
            urllib2.urlopen('http://www.maxicambios.com.py/').read(), "html.parser")
        compra = soup.find_all(class_='lineas1')[0].contents[
            7].string.replace('.', '')
        venta = soup.find_all(class_='lineas1')[0].contents[
            5].string.replace('.', '')
    except urllib2.URLError:
        compra, venta = 0, 0

    return int(compra), int(venta)


def alberdi():
    try:
        soup = BeautifulSoup(
            urllib2.urlopen('http://www.cambiosalberdi.com/').read(), "html.parser")
        compra = soup.find_all(
            class_="span2 pagination-right")[0].string.replace('.', '')
        venta = soup.find_all(
            class_="span2 pagination-right")[1].string.replace('.', '')
    except urllib2.URLError:
        compra, venta = 0, 0
    return int(compra), int(venta)

def bcp():
    pass

def create_json():
    mcompra, mventa = maxi()
    ccompra, cventa = chaco()
    acompra, aventa = alberdi()
    respjson = {
        'dolarpy': {
            'maxicambios': {
                'compra': mcompra,
                'venta': mventa<commit_msg>replace urllib2 to requests lib<commit_after>#!/usr/bin/python
import json
import urllib2
import requests

from bs4 import BeautifulSoup
from datetime import datetime


def chaco():
    try:
        soup = BeautifulSoup(
            requests.get('http://www.cambioschaco.com.py/php/imprimir_.php', timeout=8).text, "html.parser")
        compra = soup.find_all('tr')[3].contents[5].string[:5].replace('.', '')
        venta = soup.find_all('tr')[3].contents[7].string[:5].replace('.', '')
    except requests.ConnectionError:
        compra, venta = 0, 0

    return int(compra), int(venta)


def maxi():
    try:
        soup = BeautifulSoup(
            requests.get('http://www.maxicambios.com.py/', timeout=8).text, "html.parser")
        compra = soup.find_all(class_='lineas1')[0].contents[
            7].string.replace('.', '')
        venta = soup.find_all(class_='lineas1')[0].contents[
            5].string.replace('.', '')
    except requests.ConnectionError:
        compra, venta = 0, 0

    return int(compra), int(venta)


def alberdi():
    try:
        soup = BeautifulSoup(
            requests.get('http://www.cambiosalberdi.com/', timeout=8).text, "html.parser")
        compra = soup.find_all(
            class_="span2 pagination-right")[0].string.replace('.', '')
        venta = soup.find_all(
            class_="span2 pagination-right")[1].string.replace('.', '')
    except requests.ConnectionError:
        compra, venta = 0, 0
    return int(compra), int(venta)

def bcp():
    pass

def create_json():
    mcompra, mventa = maxi()
    ccompra, cventa = chaco()
    acompra, aventa = alberdi()
    respjson = {
        'dolarpy': {
            'maxicambios': {
                'compra': mcompra,
                'venta': mventa
{'fraction_non_alphanumeric': 0.16511627906976745, 'fraction_numerical': 0.01686046511627907, 'mean_word_length': 2.4969512195121952, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '1602745', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1172, 'n_words': 208}