公共devrant api的非官方python包装器

pydevrant的Python项目详细描述


面向公众的非官方python包装 devRantapi。

基于“丹尼洛兹”的非正式包装 (here)和api文档来自 “abhn”(here)。

来自官方网站devrant对于开发人员来说是一个有趣的社区 分享他们的成功和失败,并与代码、技术、 以及作为程序员的生活。devrant只由一个开发人员构建 (devrant:[@dfox](https://www.devrant.io/users/dfox)推特: [dfxNexer ](http://twit.com /dfxNeigner)和一个设计器 (devrant:[@trogus](https://www.devrant.io/users/trogus)推特: [@tim_rogus](https://twitter.com/tim_rogus))正在处理此项目 晚上和周末。

安装

使用pip安装

pip install pydevrant

功能列表

目前,您可以:

  • 获取用户ID
  • 获得咆哮
  • 得到一个带有评论的咆哮
  • 搜索rants
  • 获取用户配置文件
  • 使用用户名/密码登录
  • 发表长篇大论
  • 为咆哮投票
  • 投票评论

(注意:搜索结果是json格式的数据)

示例

post a rant

frompydevrantimport*client=Auth()user=client.login("USERNAME","PASSWORD")#first argument is body (string)#second argument is tags (string, make sure comma seperated)#third argument is type (int, 1 for rant, 5 for collab)client.post("this is my rant, do you like it?","swift, react, js",1)

vote a rant/comment

#first argument is type (rant/comment)#second argument is RANT_ID#third argument is value. (+1 for upvote, -1 for downvote)#(can only be +1 or -1. server rejects requests if any other data)client.vote("rant",1292812,+1)#for voting on a rantclient.vote("comment",1372121,+1)#for voting on a comment

查找最前面的rants,但将结果限制为一个

frompydevrantimport*frompprintimportpprint#just for nice output on terminalelem=RantParser()result=elem.get_rants(sort="top",limit=1)pprint(result)

输出如下(为了简洁起见,删除了一些部分):

{'news': {'action': 'grouprant',
          'body': 'Bad data loss story?',
          'footer': "Add tag 'wk98' to your rant",
          'headline': 'Weekly Group Rant',
          'height': 100,
          'id': 132,
          'type': 'intlink'},
 'rants': [{'attached_image': '',
            'created_time': 1474486614,
            'edited': True,
            'id': 194632,
            'num_comments': 155,
            'rc': 1,
            'rt': 1,
            'score': 2672,
            'tags': [],
            'text': 'It appears his main client had gone nuts with him because '
                    'they wanted him to make an internet toolbar (think '
                    "Ask.com) and he politely informed them toolbars doesn't "
                    "really exist anymore and it wouldn't work on things like "
                    'modern browsers or mobile devices.\n'
                    ....
                    ',
            'user_avatar': {'b': 'f99a66',
                            'i': 'v-18_c-3_b-3_g-m_9-1_1-2_16-13_3-5_8-2_7-2_5-2_12-2_6-11_10-9_2-42_15-11_11-4_4-2.jpg'},
            'user_avatar_lg': {'b': 'f99a66',
                               'i': 'v-18_c-1_b-3_g-m_9-1_1-2_16-13_3-5_8-2_7-2_5-2_12-2_6-11_10-9_2-42_15-11_11-4_4-2.png'},
            'user_id': 103918,
            'user_score': 4909,
            'user_username': 'peaam',
            'vote_state': 0}],
 'set': '5ac3b0a97b094',
 'settings': [],
 'success': True,
 'wrw': 98}

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

推荐PyPI第三方库


热门话题
在Android应用程序中处理新活动时出现java NullPointerException   从PSV文件读取Java   在JavaSwing中将方法从一个类传递到另一个类   带有MongoDB错误的java Vertx ClassNotFoundException:com。mongodb。联系溪流工厂   在java中替换2D数组中的数字?   java Avro方案空布尔和双整数布尔的写并集   java导入组织。neo4j无法解决?   从另一个获取变量。使用反射的java文件   Java:以格式化字符串的形式返回具有非常不同的条目长度的2D数组   java客户端应用程序正在从IBMMQ接收不同格式的消息体   java在我的主循环中的步骤有问题   java如何正确安装来自sslforfree的证书。tomcat服务器上的com   java RecyclerView变更单永久   java如何获得屏幕的精确中间位置,即使调整了大小