<commit_before># coding=utf-8
import json

__author__ = 'zephyre'

from celery.utils.log import get_task_logger
from apiumworker.contact.app import app
from apiumworker.etcd_conf import get_config
from urlparse import urljoin

import requests

logger = get_task_logger('apium')

hedy_host = get_config(cache_key='apiumworker.contact')['services']['hedy'].values()[0]['host']
hedy_port = get_config(cache_key='apiumworker.contact')['services']['hedy'].values()[0]['port']

essay_host = get_config(cache_key='apiumworker.contact')['apiumworker']['essayHost']

# 系统常量

# 服务号ID
systemId = 0
# 普通消息类型
common_msg = 0
# HTML页面卡片消息
card_msg = 18
# cmd消息类型
cmd_msg = 100
# tips消息类型
tips_msg = 200
# 添加讨论组成员tips类型
add_members_tips = 2001
# 删除讨论组成员tips类型
remove_members_tips = 2002
# 修改讨论组信息tips类型
mod_chatgroup_tips = 2003
# 派派
paipai = 10000


def _send_app_intro(receiver_id):
    """
    发送APP简介的消息
    :param receiver_id:
    :return:
    """
    title = u'旅行派的正确打开方式'
    href = '/2015080701/index.html'
    url = urljoin(essay_host, href)
    desc = None
    image = 'http://images.taozilvxing.com/lvxingpai_logo_v1.png'
    message = _build_html_message(10000, receiver_id, title, url, desc, image)
    _send_message(message)


def _send_mt_message(receiver_id):
    """
    发送梦婷的HTML页面
    :param receiver_id:
    :return:
    """
    title = u'将世界走出自己的模样'
    desc = u'一个人，14个国家，367个日夜，48266公里路'
    image = 'http://taozi-uploads.qiniudn.com/avt_11000_1433748012390.jpg'
    href = '/2015082401/index.html'
    url = urljoin(essay_host, href)
    message = _build_html_message(10000, receiver_id, title, url, desc, image)
    _send_message(message)


def _build_text_message(sender_id, receiver_id, text):<commit_msg>FIX: 修复发送错了的页面<commit_after># coding=utf-8
import json

__author__ = 'zephyre'

from celery.utils.log import get_task_logger
from apiumworker.contact.app import app
from apiumworker.etcd_conf import get_config
from urlparse import urljoin

import requests

logger = get_task_logger('apium')

hedy_host = get_config(cache_key='apiumworker.contact')['services']['hedy'].values()[0]['host']
hedy_port = get_config(cache_key='apiumworker.contact')['services']['hedy'].values()[0]['port']

essay_host = get_config(cache_key='apiumworker.contact')['apiumworker']['essayHost']

# 系统常量

# 服务号ID
systemId = 0
# 普通消息类型
common_msg = 0
# HTML页面卡片消息
card_msg = 18
# cmd消息类型
cmd_msg = 100
# tips消息类型
tips_msg = 200
# 添加讨论组成员tips类型
add_members_tips = 2001
# 删除讨论组成员tips类型
remove_members_tips = 2002
# 修改讨论组信息tips类型
mod_chatgroup_tips = 2003
# 派派
paipai = 10000


def _send_app_intro(receiver_id):
    """
    发送APP简介的消息
    :param receiver_id:
    :return:
    """
    title = u'旅行派的正确打开方式'
    href = '/2015080701/index.html'
    url = urljoin(essay_host, href)
    desc = None
    image = 'http://images.taozilvxing.com/lvxingpai_logo_v1.png'
    message = _build_html_message(10000, receiver_id, title, url, desc, image)
    _send_message(message)


def _send_mt_message(receiver_id):
    """
    发送梦婷的HTML页面
    :param receiver_id:
    :return:
    """
    title = u'将世界走出自己的模样'
    desc = u'一个人，14个国家，367个日夜，48266公里路'
    image = 'http://taozi-uploads.qiniudn.com/avt_11000_1433748012390.jpg'
    href = '/2015072801/index.html'
    url = urljoin(essay_host, href)
    message = _build_html_message(10000, receiver_id, title, url, desc, image)
    _send_message(message)


def _build_text_message(sender_id, receiver_id, text):
{'fraction_non_alphanumeric': 0.12030294203320711, 'fraction_numerical': 0.05184969414506263, 'mean_word_length': 4.840136054421769, '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': '4528562', 'n_tokens_mistral': 1582, 'n_tokens_neox': 1504, 'n_words': 228}