microurl是一个python模块,用于创建minifiedurl

microurl的Python项目详细描述


https://readthedocs.org/projects/microurl/badge/?version=latesthttps://img.shields.io/pypi/dm/microurl.svghttps://img.shields.io/pypi/v/microurl.svghttps://travis-ci.org/MicroPyramid/microurl.svg?branch=masterhttps://coveralls.io/repos/github/MicroPyramid/microurl/badge.svg?branch=masterhttps://img.shields.io/pypi/l/microurl.svg

用于url缩小的python库。

功能

  • 谷歌
    • 网址缩小符
    • 二维码发生器
  • 比特
    • URL迷你者

安装

通过pip安装microurl

$ pip install microurl

或者,如果您想要github上当前的代码

git clone git://github.com/micropyramid/microurl.git
cd microurl
python setup.py install

开始

首先,你要去google或bily或supr注册一个应用程序

注册后,从“应用程序详细信息”选项卡中获取应用程序Consumer KeyConsumer Secret

首先,您需要从microurl导入所需的minfier

frommicrourlimportgoogle_mini

google mini的基本用法

函数定义(即google_mini())可以通过阅读microurl/google.py找到

minified=google_mini('validurl','Google_API_KEY')

就这么简单。

二维码发生器

qr_url=qrcode(url)

Bitly的身份验证

frommicrourlimportbitlyauthenticationauthentication=bitlyauthentication(client_id,client_secret,redirect_uri)auth_url=authentication.authorization_url()

在浏览器中打开auth_url。授权应用程序后,将重定向到使用代码perameter重定向url。

access_token=authentication.get_accesstoken_from_code(code)# code that you get to redirect_url in the above step

使用用户名和密码进行身份验证

access_token=authentication.get_accesstoken_from_username_pwd(bitlyusernameorloginemail,password)

Bitly的基本用法

函数定义(即shorturl())可以通过读取microurl/bitly.py找到

frommicrourlimportbitlyapibitly=bitlyapi(access_token)# access_token is getting from previous stepsminified=bitly.shorturl(longurl,domain)['url']# domain is optional here

获取bitlylink的详细信息。

bitly.url_info(bitlylink,expand_user='True | False',hash='one or more bitly hashes')# expand_user,hash are optional here

获取单个位链接的单击次数。

bitly.link_clicks(bitlylink,unit="day",units=10,timezone=-4,limit=20,unit_reference_ts="now")# here except bitlylink all are optional

获取单个位链接上的共享数。

bitly.link_shares(bitlylink,unit="day",units=10,timezone=-4,limit=20,unit_reference_ts="now")# here except bitlylink all are optional

获取loggedin用户信息

bitly.user_info()

按时间倒序获取用户链接历史。

bitly.user_linkhistory(bitlylink,limit=20,offset=1,created_after='1381000000',created_before='1381844314',expand_client_id=True,archived="both",private="both")# here all fields are optional

想帮忙吗?

microurl是有用的,但最终只能和使用它的人一样有用(比如说十倍的速度!)。如果你想提供帮助,请编写示例代码、提供修补程序、在wiki上记录内容、在tweet上发布相关信息。感谢您的帮助!

有关更多更新

https://micropyramid.com/oss/

我们欢迎您的反馈和支持,如果您想报告错误,请提交github票证。需要新功能吗?Contact us here

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java读取SSLSocket的最快或最佳方式   JavaGuice向类构造函数注入对象   java类不是抽象的,并且不会覆盖OnClickListener中的抽象方法onClick(视图)   java OpenGL 1.1更改颜色更改以前的颜色?   c#将Java/Android连接到。网络服务   java在节点上生成AES密钥   java Liferay与MarkLogic XDBC数据库集成   java使用静态初始化块来提高性能   java如何在需要不同参数的另一个方法中使用同一类中的方法   音频Java多种声音   Java显式引用转换   java Intellij,如何在maven项目中导入模块   java在什么条件下调用ELResolver的setValue方法?   java在beanshell中计算代码字符串并获取beanshell解释器返回的值   javascript将音频文件上载到服务器并从服务器响应设置图像   编码风格清理java代码,多个else if语句   java是否需要使此变量可变?   java线程未更新GlassPane上的进度条   java关闭调试模式@Vaadin Spring启动应用程序