# Path: lib/_db.py
# def get_collection(db_name, collection_name, client='mongo'):
#     client = client_db_map.get(client)
#     db = getattr(client, db_name, None)
#     return getattr(db, collection_name, None)


import _env
import json
import requests
from pprint import pprint
from lib._db import get_collection
from config.config import CONFIG
    from Queue import Queue
    from queue import Queue
#!/usr/bin/env python
# -*- coding:utf-8 -*-


DB = CONFIG.MONGO.DATABASE

try:
except ImportError:

URL = 'http://api.xianguo.com/i/status/get.json?key=36d979af3f6cecd87b89720d3284d420'


def to_dict(form):
    d = {}
    arg_list = form.rstrip('&').split('&')
    for i in arg_list:
        k = i.split('=')[0]
        v = i.split('=')[1]
        d[k] = v
    return d


def fetch(url, data_dict=None):
    return requests.post(url, data=data_dict, timeout=10).text


def xianguo_spider(q, coll_name='tech', max_news_num=1000):

# Path: lib/_db.py
# def get_collection(db_name, collection_name, client='mongo'):
#     client = client_db_map.get(client)
#     db = getattr(client, db_name, None)
#     return getattr(db, collection_name, None)


# Path: crawler/xianguo/xianguo.py
import _env
import json
import requests
from pprint import pprint
from lib._db import get_collection
from config.config import CONFIG
    from Queue import Queue
    from queue import Queue

#!/usr/bin/env python
# -*- coding:utf-8 -*-


DB = CONFIG.MONGO.DATABASE

try:
except ImportError:

URL = 'http://api.xianguo.com/i/status/get.json?key=36d979af3f6cecd87b89720d3284d420'


def to_dict(form):
    d = {}
    arg_list = form.rstrip('&').split('&')
    for i in arg_list:
        k = i.split('=')[0]
        v = i.split('=')[1]
        d[k] = v
    return d


def fetch(url, data_dict=None):
    return requests.post(url, data=data_dict, timeout=10).text


def xianguo_spider(q, coll_name='tech', max_news_num=1000):

    _COLL = get_collection(DB, coll_name)