Skip to content

Commit

Permalink
bump to v0.1.19, support tianyancha
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesPikachu committed May 6, 2022
1 parent 19efe19 commit eb1799c
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ You can star this repository to keep track of the project if it's helpful for yo
| ukrainemap | [click](https://mp.weixin.qq.com/s/zthIMtWqF7mJiIlXy1-bsA) | [click](./pytools/modules/ukrainemap) | 乌克兰地图查询系统 |
| sovietgenerator | [click](https://mp.weixin.qq.com/s/PUTJxDLpCVRSaUzvarizEQ) | [click](./pytools/modules/sovietgenerator) | 苏联笑话生成器 |
| goodgoodgenerator | [click](https://mp.weixin.qq.com/s/mH9LyIdHe1uX2E3oAjlIoQ) | [click](./pytools/modules/goodgoodgenerator) | 稳中向好生成器 |
| tianyancha | [click]() | [click](./pytools/modules/tianyancha) | 天眼查 |


# Install
Expand Down
7 changes: 6 additions & 1 deletion docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,9 @@
**2022-04-25**

- 版本号: v0.1.18,
- 更新内容: 支持稳中向好生成器。
- 更新内容: 支持稳中向好生成器。

**2022-05-06**

- 版本号: v0.1.19,
- 更新内容: 支持天眼查。
27 changes: 27 additions & 0 deletions docs/Quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,33 @@ tool_client.execute('goodgoodgenerator')
}
```

#### 天眼查

**1.公众号文章链接**

[点击查看]()

**2.功能介绍**

天眼查GUI版本。

**3.调用示例代码**

```python
from pytools import pytools

tool_client = pytools.pytools()
tool_client.execute('tianyancha')
```

**4.config中支持的参数**

```
{
title: 软件显示的标题, 默认值"天眼查 —— Charles的皮卡丘",
}
```


## 随机运行一个小程序

Expand Down
2 changes: 1 addition & 1 deletion pytools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'''url'''
__url__ = 'https://github.com/CharlesPikachu/pytools'
'''version'''
__version__ = '0.1.18'
__version__ = '0.1.19'
'''author'''
__author__ = 'Charles'
'''email'''
Expand Down
1 change: 1 addition & 0 deletions pytools/modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .timer import Timer
from .clock import Clock
from .runcat import RunCat
from .tianyancha import Tianyancha
from .ukrainemap import UkraineMap
from .desktoppet import DesktopPet
from .translator import Translator
Expand Down
2 changes: 2 additions & 0 deletions pytools/modules/tianyancha/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'''初始化'''
from .tianyancha import Tianyancha
Binary file added pytools/modules/tianyancha/resources/icon.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 112 additions & 0 deletions pytools/modules/tianyancha/tianyancha.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
'''
Function:
天眼查
Author:
Charles
微信公众号:
Charles的皮卡丘
'''
import os
import requests
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5 import QtWidgets, QtGui


'''天眼查'''
class Tianyancha(QWidget):
tool_name = '天眼查'
def __init__(self, parent=None, title='天眼查 —— Charles的皮卡丘', **kwargs):
super(Tianyancha, self).__init__(parent)
rootdir = os.path.split(os.path.abspath(__file__))[0]
self.setFixedSize(800, 500)
self.setWindowTitle(title)
self.setWindowIcon(QIcon(os.path.join(rootdir, 'resources/icon.jpeg')))
# 定义一些必要的组件
grid = QGridLayout()
# --标签
label = QLabel('想要查询的公司名:')
# --输入框
self.edit = QLineEdit()
self.edit.setText('万门大学')
# --生成按钮
button_query = QPushButton('查询公司')
# --结果显示框
self.text_edit = QTextEdit()
# 组件布局
grid.addWidget(label, 0, 0, 1, 1)
grid.addWidget(self.edit, 0, 1, 1, 1)
grid.addWidget(button_query, 1, 0, 1, 2)
grid.addWidget(self.text_edit, 2, 0, 5, 2)
self.setLayout(grid)
# 事件绑定
button_query.clicked.connect(self.query)
'''查询公司'''
def query(self):
company_name = self.edit.text()
# 获取基本信息
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36',
'version': 'TYC-XCX-WX',
'Host': 'api9.tianyancha.com',
'Authorization': '0###oo34J0VKzLlpdvf8kgFkMlfU_IPY###1642087379312###22494f3155c2e5a4be76e503837fa439',
'x-auth-token': 'eyJkaXN0aW5jdF9pZCI6IjE3ZDFjNWVhMzZjNGY2LTA5ZjU2NWUwNWViNTZjLTFjMzA2ODUxLTIwNzM2MDAtMTdkMWM1ZWEzNmRiMzYiLCJsaWIiOnsiJGxpYiI6ImpzIiwiJGxpYl9tZXRob2QiOiJjb2RlIiwiJGxpYl92ZXJzaW9uIjoiMS4xNS4yNCJ9LCJwcm9wZXJ0aWVzIjp7IiR0aW1lem9uZV9vZmZzZXQiOi00ODAsIiRzY3JlZW5faGVpZ2h0IjoxMDgwLCIkc2NyZWVuX3dpZHRoIjoxOTIwLCIkbGliIjoianMiLCIkbGliX3ZlcnNpb24iOiIxLjE1LjI0IiwiJGxhdGVzdF90cmFmZmljX3NvdXJjZV90eXBlIjoi6Ieq54S25pCc57Si5rWB6YePIiwiJGxhdGVzdF9zZWFyY2hfa2V5d29yZCI6IuacquWPluWIsOWAvCIsIiRsYXRlc3RfcmVmZXJyZXIiOiJodHRwczovL3d3dy5nb29nbGUuY29tLyIsImN1cnJlbnRfdXJsIjoiaHR0cHM6Ly93d3cudGlhbnlhbmNoYS5jb20vc2VhcmNoP2tleT0lRTYlOUQlQUQlRTUlQjclOUUlRTYlOTklQUUlRTUlODUlQjQlRTQlQkMlODElRTQlQjglOUElRTclQUUlQTElRTclOTAlODYlRTUlOTAlODglRTQlQkMlOTklRTQlQkMlODElRTQlQjglOUEiLCJyZWZlcnJlciI6Imh0dHBzOi8vd3d3LnRpYW55YW5jaGEuY29tL3NlYXJjaD9rZXk9JUU2JTlEJUFEJUU1JUI3JTlFJUU2JTk5JUFFJUU1JTg1JUI0JUU0JUJDJTgxJUU0JUI4JTlBJUU3JUFFJUExJUU3JTkwJTg2JUU1JTkwJTg4JUU0JUJDJTk5JUU0JUJDJTgxJUU0JUI4JTlBIiwidHljaWQiOiI0MmMxZTY1MDQ0ZjYxMWVjYmIxZDY3ZmJiYzEwN2U3NSIsIm5hbWUiOiLmna3lt57mma7lhbTkvIHkuJrnrqHnkIblkIjkvJnkvIHkuJoiLCJtb2R1bGUiOiLkvJjotKjlrp7lkI3orqTor4EiLCIkaXNfZmlyc3RfZGF5IjpmYWxzZX0sImFub255bW91c19pZCI6IjE3ZDFjNWVhMzZjNGY2LTA5ZjU2NWUwNWViNTZjLTFjMzA2ODUxLTIwNzM2MDAtMTdkMWM1ZWEzNmRiMzYiLCJ0eXBlIjoidHJhY2siLCJldmVudCI6InNlYXJjaF9yZXN1bHRfZXhwdXJlIiwiX3RyYWNrX2lkIjo3MjUyNDM3Mjd9',
}
url = f'https://api9.tianyancha.com/services/v3/search/sNorV3/{company_name}'
response = requests.get(url, headers=headers)
response_json, data = response.json(), dict()
if response_json['state'] == 'ok':
data = response_json.get('data', {})
# 基本信息提取
company_info = {'未查询到该公司相关的信息': ''}
if data:
company = data['companyList'][0]
for item in data['brandAndAgencyList']:
if item['graphId'] == company['id']:
brand_and_agency = item
break
detail = requests.get(f'https://api9.tianyancha.com/services/v3/t/common/baseinfoV5/{company["id"]}', headers=headers).json().get('data', {})
company_info = {
'公司外部系统ID': company.get('id', ''),
'公司名称': company.get('name', '').replace('<em>', '').replace('</em>', ''),
'公司简称 ': company.get('alias', ''),
'公司法人': company.get('legalPersonName', ''),
'公司成立时间': company.get('estiblishTime', '')[:10],
'公司注册地址': company.get('regLocation', ''),
'公司所在省份': company.get('base', ''),
'公司所在市': company.get('city', ''),
'公司所在区': company.get('district', ''),
'公司经营状态': company.get('regStatus', ''),
'公司地址经纬度坐标': (company.get('latitude', ''), company.get('longitude', '')),
'公司邮箱列表': company.get('emails', '').split(';')[0].replace('\t', ''),
'公司联系方式列表': company.get('phoneList', ''),
'公司联系方式': company.get('phoneNum', ''),
'公司经营范围': company.get('businessScope', ''),
'公司类型': company.get('companyOrgType', '').replace('\t', ''),
'公司质量分数': company.get('orginalScore', ''),
'公司注册资本': company.get('regCapital', ''),
'公司统一社会信用代码': company.get('creditCode', ''),
'公司纳税号': company.get('taxCode', '') or company.get('creditCode', ''),
'公司注册号': company.get('regNumber', ''),
'公司组织机构代码': company.get('orgNumber', ''),
'公司标签列表': company.get('labelListV2', ''),
'公司行业分类': company.get('categoryStr', ''),
'公司融资轮次': brand_and_agency.get('round', ''),
'公司竟品信息': brand_and_agency.get('jingpinName', ''),
'公司logo': brand_and_agency.get('logo', '') or detail.get('logo', ''),
'公司简介': brand_and_agency.get('intro', '') or detail.get('baseInfo', ''),
'公司英文名': detail.get('property3', '') or detail.get('nameEn', ''),
'公司注册机构': detail.get('regInstitute', ''),
'公司网站地址集': detail.get('websiteList', ''),
'公司实缴资本': detail.get('actualCapital', ''),
'公司曾用名': detail.get('historyNames', ''),
'公司员工人数': detail.get('socialStaffNum', '') or detail.get('staffNum', ''),
'公司纳税地址': detail.get('taxAddress', '') or detail.get('regLocation', ''),
'公司纳税银行': detail.get('taxBankName', ''),
'公司涉足领域标签': detail.get('portray', ''),
}
# 打印
company_info_str = ''
for key, value in company_info.items():
company_info_str += f'{key}: {value}\n'
self.text_edit.setText(company_info_str)
4 changes: 2 additions & 2 deletions pytools/pytools.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def execute(self, tool_type=None, config={}):
qt_tools = [
'newyearcardgenerator', 'luxunsentencesquery', 'artsigngenerator', 'genderpredictor', 'musicplayer', 'qrcodegenerator', 'videoplayer',
'trumptweetsgenerator', 'coupletgenerator', 'idcardquery', 'idiomsolitaire', 'inquiryexpress', 'succulentquery', 'translator',
'desktoppet', 'computersinger', 'hubbleseeonbirthday', 'ukrainemap', 'sovietgenerator', 'goodgoodgenerator'
'desktoppet', 'computersinger', 'hubbleseeonbirthday', 'ukrainemap', 'sovietgenerator', 'goodgoodgenerator', 'tianyancha'
]
if tool_type in qt_tools:
app = QApplication(sys.argv)
Expand All @@ -51,7 +51,7 @@ def initialize(self):
'iplocationquery': IPLocationQuery, 'genderpredictor': GenderPredictor, 'qrcodegenerator': QRCodeGenerator, 'coupletgenerator': CoupletGenerator,
'artsigngenerator': ArtSignGenerator, 'controlpcbyemail': ControlPCbyEmail, 'naughtyconfession': NaughtyConfession, 'luxunsentencesquery': LuxunSentencesQuery,
'hubbleseeonbirthday': HubbleSeeOnBirthday, 'newyearcardgenerator': NewYearCardGenerator, 'trumptweetsgenerator': TrumpTweetsGenerator, 'sovietgenerator': SovietGenerator,
'goodgoodgenerator': GoodGoodGenerator,
'goodgoodgenerator': GoodGoodGenerator, 'tianyancha': Tianyancha,
}
return supported_tools
'''获得所有支持的tools信息'''
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
package_data.update({
'pytools.modules.goodgoodgenerator': ['resources/*']
})
package_data.update({
'pytools.modules.tianyancha': ['resources/*']
})


'''setup'''
Expand Down

0 comments on commit eb1799c

Please sign in to comment.