<commit_before># -*- coding:utf-8 -*-

"""
Created by haven on 16/8/20.
"""
from config import config
import requests

import utils


def requestDidi():
    # login_data = {"username": username, "password": password, "action": 'login', 'ajax': '1', 'ac_id': '4'}
    header = config['didi']['header']
    url = config['didi']['url']
    params = config['didi']['params']
    r = requests.get(url, params=params, headers=header)
    print(r.text, r.status_code)


def get_price(from_lat, from_lon, to_lat, to_lon):
    header = config['didi']['header']
    url = config['didi']['url']
    params = {
        'userlat': from_lat,
        'userlng': from_lon,
        'flat': from_lat,
        'flng': from_lon,
        'tlat': to_lat,
        'tlng': to_lon
        # 'appTime': utils.getUnixTime()
    }
    # print params
    params = dict(params, **config['didi']['params'])

    # print url
    # print params
    # print header
    ret = requests.get(url, params=params, headers=header).json()
    return {
        'single_price': float(ret['estimateFee_num']),
        'pool_price': -1,
        'distance': ret['estimate_fee_data'][0]['distance'],
        'duration': int(ret['estimate_fee_data'][0]['time_cost']) * 60,
        'name': 'didi',
        'wait_time': utils.get_int(ret['arriveTimeTips']) * 60
    }

# requestDidi()<commit_msg>add didi fee<commit_after># -*- coding:utf-8 -*-

"""
Created by haven on 16/8/20.
"""
from config import config
import requests

import utils


def requestDidi():
    # login_data = {"username": username, "password": password, "action": 'login', 'ajax': '1', 'ac_id': '4'}
    header = config['didi']['header']
    url = config['didi']['url']
    params = config['didi']['params']
    r = requests.get(url, params=params, headers=header)
    print(r.text, r.status_code)


def get_price(from_lat, from_lon, to_lat, to_lon):
    header = config['didi']['header']
    url = config['didi']['url']
    params = {
        'userlat': from_lat,
        'userlng': from_lon,
        'flat': from_lat,
        'flng': from_lon,
        'tlat': to_lat,
        'tlng': to_lon
        # 'appTime': utils.getUnixTime()
    }
    # print params
    params = dict(params, **config['didi']['params'])

    # print url
    # print params
    # print header
    ret = requests.get(url, params=params, headers=header).json()
    return {
        'single_price': float(ret['estimateFee_num'])+4,
        'pool_price': -1,
        'distance': ret['estimate_fee_data'][0]['distance'],
        'duration': int(ret['estimate_fee_data'][0]['time_cost']) * 60,
        'name': 'didi',
        'wait_time': utils.get_int(ret['arriveTimeTips']) * 60
    }

# requestDidi()
{'fraction_non_alphanumeric': 0.18394648829431437, 'fraction_numerical': 0.011519881085098476, 'mean_word_length': 3.1736434108527134, 'pattern_counts': {'":': 6, '<': 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': '1524456', 'n_tokens_mistral': 932, 'n_tokens_neox': 919, 'n_words': 191}