账号获取
- 在https://dwz.cn/注册,可以手工处理,如果想写程序批量搞定,也可以使用代码模式。
- 下面仅以python的SDK为例,将”你的token”替换成你真实token结果。
- 据说可以加强百度搜索引擎收录。
生成
#!/usr/bin/python# -*- coding: utf-8 -*-import requestsimport jsonhost = 'https://dwz.cn'path = '/admin/v2/create'url = host + pathmethod = 'POST'content_type = 'application/json'# TODO: 设置Tokentoken = '你的token'# TODO:设置待创建的长网址bodys = {'url':'http://blog.uhaka.com'}# 配置headersheaders = {'Content-Type':content_type, 'Token':token}# 发起请求response = requests.post(url=url, data=json.dumps(bodys), headers=headers)# 读取响应print(response.text)
还原
#!/usr/bin/python# -*- coding: utf-8 -*-import requestsimport jsonhost = 'https://dwz.cn'path = '/admin/v2/query'url = host + pathmethod = 'POST'content_type = 'application/json'# TODO: 设置Tokentoken = '你的token'# TODO:设置待还原的短网址bodys = {'shortUrl':'https://dwz.cn/2mdxX0WC'}# 配置headersheaders = {'Content-Type':content_type, 'Token':token}# 发起请求response = requests.post(url=url, data=json.dumps(bodys), headers=headers)# 读取响应print(response.text)