1 Star 0 Fork 1

abc-edb-fund/edb_mapping_china_money

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
config.py 1.94 KB
一键复制 编辑 原始数据 按行查看 历史
李新 提交于 2018-07-17 18:50 . Initial commit
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/7/17 18:48
# @Author : Orient
# @File : config.py
# @Software: PyCharm
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/7/16 16:22
# @Author : Orient
# @File : config.py
# @Software: PyCharm
import pymysql
import pymongo
import sys
import traceback
adict = {
"/": "\/",
":": "\:",
"_": "\_",
"、": "\、",
"(": "\(",
")": "\)",
"(": "\(",
")": "\)",
"&": "\&",
"%": "\%",
"%": "\%",
"≥": "\≥",
"=": "\=",
"=": "\=",
"—": "\—",
"-": "\-"
}
#mongo连接信息
MONGODB_CONFIG_CT = {
'host': '114.55.39.144',
'port': 3717,
'db_name': 'original_data',
'username': 'crawler_team',
'password': 'Ur4Q6h2pgA6X4G9h'
}
config_data_center = {
'host': '118.31.118.16',
'port': 3306,
'user': 'dc_select',
'passwd': 'Aenl1pnBtXWpQ5DW',
'db': 'data_center',
'charset': 'utf8'}
def conn_data_center():
conn = pymysql.connect(**config_data_center)
cursor = conn.cursor()
return cursor
#mongo连接
class MongoConnCT(object):
def __init__(self):
# connect db
try:
self.conn = pymongo.MongoClient(MONGODB_CONFIG_CT['host'], MONGODB_CONFIG_CT['port'])
self.db = self.conn[MONGODB_CONFIG_CT['db_name']] # connect db
self.username=MONGODB_CONFIG_CT['username']
self.password=MONGODB_CONFIG_CT['password']
if self.username and self.password:
self.connected = self.db.authenticate(self.username, self.password)
else:
self.connected = True
except Exception:
print(traceback.format_exc())
print('Connect Statics Database Fail.')
sys.exit(1)
if __name__ == '__main__':
pass
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/edbmapping/edb_mapping_china_money.git
git@gitee.com:edbmapping/edb_mapping_china_money.git
edbmapping
edb_mapping_china_money
edb_mapping_china_money
master

搜索帮助