Skip to main content

个人工具库,主要用于SEO,数据采集方面

Project description

思明的个人工具库

该工具库主要是把我平时常用的SEO代码、数据采集代码进行封装,方面在不同的项目中引用。 如果你使用该工具库,本人无法保证代码的稳定性。

安装

pip install ysmtool

使用

import ysmtool

Http模块

http=ysmtool.Http()

status,html=http.get(”https://www.baidu.com”)

有get 和 post 方法, 返回 (status,html) , status 为 请求返回的状态码,数值型。

ip:指定本地出口IP,如果是多网卡服务器,设置为相应网卡绑定的IP地址,就会从指定网卡进行请求

gbk:如果返回的源码是gb2312,gbk之类的,设置为True

serverIp:指定域名对应的IP,可以免解析,或者截持

ua: user_agent

cookie: cookie文本

serverPort:网站对应的端口

http.get(self,url,ip=None,ua=’’,refer=’’,cookie=’’,gbk=False,serverIp=’’,serverPort=’’)

http.post(self,url,ip=None,ua=’’,refer=’’,cookie=’’,data={},gbk=False,serverIp=’’,serverPort=’’)

baidu模块

status,num=ysmtool.baidu.index(‘www.taobao.com’) 淘宝的百度收录 , 正常返回的话, status == 200

haosou模块

status,num=ysmtool.haosou.index(‘www.taobao.com’) 淘宝的360收录 , 正常返回的话, status == 200

联系我

有问题请发邮箱至 simon@yesiming.com 或者QQ: 176089710

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ysmtool-0.2.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file ysmtool-0.2.tar.gz.

File metadata

  • Download URL: ysmtool-0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ysmtool-0.2.tar.gz
Algorithm Hash digest
SHA256 8e2e9d638090635281723056bb145a0875cbc522d768e420cd1207426b4a9204
MD5 011e794e769ee09e155b25223e6ed125
BLAKE2b-256 07499b53dac14a31ad9b55fe4b66a6031a0d88a892db0a3f15f8ef23b7a87d1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page