zoukankan      html  css  js  c++  java
  • 将公网IP自动发到Twitter上

    [Twitter]

    1. 在https://apps.twitter.com/创建新的应用

    2. 在https://dev.twitter.com/rest/reference/post/statuses/update页面下的OAuth Signature Generator点击刚才创建的应用。

    参考:
    http://blog.csdn.net/csfreebird/article/details/18238465
    https://dev.twitter.com/rest/reference/post/statuses/update

    [Python]

    1. 首先安装python-pip, 然后通过pip install tweepy, 此时运行脚本虽然成功但是会提示以下告警:

    root@ubuntu1404:/home/chen# python postip.py 
    /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
      SNIMissingWarning
    /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
      InsecurePlatformWarning

    2. 安装这些组件可以消除告警信息: pip install pyopenssl ndg-httpsclient pyasn1

    #!/usr/bin/env python
    import
    tweepy import requests consumer_key = 'f....j' consumer_secret = 'W....8' access_token = '4....j' access_token_secret = 'Q....M' auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) api = tweepy.API(auth) html = requests.get('http://ip.3322.net') api.update_status(status=html.text)

    参考:

    https://www.phodal.com/blog/python-pip-openssl-issue/

    http://blog.topspeedsnail.com/archives/3380

  • 相关阅读:
    一个web程序员的年终总结
    编程要诀-心态
    初识vps,域名与购买,初步配置
    一个好的学习方法真的很重要——费曼学习法
    [译]C# 7系列,Part 8: in Parameters in参数
    Dalsa 8K彩色相机Camera link C#采图
    精简Command版SqlHelper
    ASP.NET MVC模块化开发——动态挂载外部项目
    net core WebApi——依赖注入Autofac
    .NET Core 3 WPF MVVM框架 Prism系列之命令
  • 原文地址:https://www.cnblogs.com/IvanChen/p/5227788.html
Copyright © 2011-2022 走看看