Exemple #1
0
def j_connection(url):
    try:
        http = urllib3.PoolManager()
        weburl = http.request('GET', url)
        data = weburl.data.decode('utf-8')
        return data

    except urllib3.exceptions:
        print('Error')
        # return j_data, j_data1
    return
def get_eur():
    global ERROR_READ
    url = 'https://www.xe.com/currencyconverter/convert/?Amount=1&From=EUR&To=USD'
    page = urllib3.PoolManager(cert_reqs='CERT_REQUIRED',
                               ca_certs=certifi.where()).request('GET', url)
    soup = BeautifulSoup(page.data, 'html.parser')
    try:
        eur_price = soup.find('span', attrs={'class': 'uccResultAmount'}).text
        eur_price = '€' + eur_price
        print(eur_price)
        return "EUR: {}".format(eur_price)
    except AttributeError:
        return ERROR_READ
Exemple #3
0
    def __init__(self, host_addr = "155.230.90.217", port_number = 5004, silence = False):
        # etri nlp server address
        self.host_addr = host_addr
        # port number
        self.port_number = port_number
        self.client = Etri_client(self.host_addr, self.port_number, silence)

        # open API version
        self.openApiURL = "http://aiopen.etri.re.kr:8000/WiseNLU"
        self.accessKey = "" # your key
        self.analysisCode = "ner" # 형태소 분석 : morp
                                    # 어휘의미 분석(동음이의어 분석) : "wsd"
                                    # 어휘의미 분석 (다의어 분석) : "wsd_poly"
                                    # 개체명 인식 : "ner"
                                    # 의존 구문 분석 : "dparse"
                                    # 의미역 인식 : "srl"
        self.http = urllib3.PoolManager()
def get_bch():
    global ERROR_READ
    url = 'https://www.worldcoinindex.com/coin/bitcoincash'
    page = urllib3.PoolManager(cert_reqs='CERT_REQUIRED',
                               ca_certs=certifi.where()).request('GET', url)
    soup = BeautifulSoup(page.data, 'html.parser')
    try:
        bch_price = soup.find('div',
                              attrs={
                                  'class': 'col-md-6 col-xs-6 coinprice'
                              }).text
        bch_price = re.sub("[^0-9.,$]", "", bch_price)
        print(bch_price)
        bch_change = soup.find('div',
                               attrs={
                                   'class': 'col-md-6 col-xs-6 coin-percentage'
                               }).text
        bch_change = re.sub("[^0-9.,%\-+]", "", bch_change)
        print(bch_change)
        return "BCH: {}, change: {}".format(bch_price, bch_change)
    except AttributeError:
        return ERROR_READ