Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 我可以使用tweepy和python从twitter用户那里获得电子邮件地址吗?_Python 3.x_Twitter_Jupyter Notebook_Tweepy - Fatal编程技术网

Python 3.x 我可以使用tweepy和python从twitter用户那里获得电子邮件地址吗?

Python 3.x 我可以使用tweepy和python从twitter用户那里获得电子邮件地址吗?,python-3.x,twitter,jupyter-notebook,tweepy,Python 3.x,Twitter,Jupyter Notebook,Tweepy,您好,我有来自verify_凭据的json,因为用户允许我使用在twitter上开发的应用程序进行访问,但我找不到如何查看电子邮件,因为在“dir(api)”中没有相关方法,我对这个问题没有更多的想法,我使用jupyter和tweepy,有什么想法吗 api=tweepy.api(auth) 通过这个我可以看到json 目录(api) 这是为这个问题开发的代码 我的问题是,如果我可以从python访问,我如何查看一个twitter用户的电子邮件地址?是的,您可以,但为此,您需要在您的twitte

您好,我有来自verify_凭据的json,因为用户允许我使用在twitter上开发的应用程序进行访问,但我找不到如何查看电子邮件,因为在“dir(api)”中没有相关方法,我对这个问题没有更多的想法,我使用jupyter和tweepy,有什么想法吗

api=tweepy.api(auth)
通过这个我可以看到json
目录(api)

这是为这个问题开发的代码


我的问题是,如果我可以从python访问,我如何查看一个twitter用户的电子邮件地址?

是的,您可以,但为此,您需要在您的twitter应用程序上启用添加权限

“从用户请求电子邮件地址”复选框在上的应用权限下可用。必须在应用程序设置中填写隐私策略URL和服务条款URL字段,才能访问电子邮件地址。如果启用,将通过oauth/授权对话框通知用户您的应用程序可以访问他们的电子邮件地址

样品请求
GEThttps://api.twitter.com/1.1/account/verify_credentials.json

示例响应

 {
    "contributors_enabled": true,
    "created_at": "Sat May 09 17:58:22 +0000 2009",
    "default_profile": false,
    "default_profile_image": false,
    "description": "I taught your phone that thing you like.  The Mobile Partner Engineer @Twitter. ",
    "favourites_count": 588,
    "follow_request_sent": null,
    "followers_count": 10625,
    "following": null,
    "friends_count": 1181,
    "geo_enabled": true,
    "id": 38895958,
    "id_str": "38895958",
    "is_translator": false,
    "lang": "en",
    "listed_count": 190,
    "location": "San Francisco",
    "name": "Sean Cook",
    "notifications": null,
    "profile_background_color": "1A1B1F",
    "profile_background_image_url": "http://a0.twimg.com/profile_background_images/495742332/purty_wood.png",
    "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/495742332/purty_wood.png",
    "profile_background_tile": true,
    "profile_image_url": "http://a0.twimg.com/profile_images/1751506047/dead_sexy_normal.JPG",
    "profile_image_url_https": "https://si0.twimg.com/profile_images/1751506047/dead_sexy_normal.JPG",
    "profile_link_color": "2FC2EF",
    "profile_sidebar_border_color": "181A1E",
    "profile_sidebar_fill_color": "252429",
    "profile_text_color": "666666",
    "profile_use_background_image": true,
    "protected": false,
    "screen_name": "theSeanCook",
    "show_all_inline_media": true,
    "status": {
        "contributors": null,
        "coordinates": {
            "coordinates": [
                -122.45037293,
                37.76484123
            ],
            "type": "Point"
        },
        "created_at": "Tue Aug 28 05:44:24 +0000 2012",
        "favorited": false,
        "geo": {
            "coordinates": [
                37.76484123,
                -122.45037293
            ],
            "type": "Point"
        },
        "id": 240323931419062272,
        "id_str": "240323931419062272",
        "in_reply_to_screen_name": "messl",
        "in_reply_to_status_id": 240316959173009410,
        "in_reply_to_status_id_str": "240316959173009410",
        "in_reply_to_user_id": 18707866,
        "in_reply_to_user_id_str": "18707866",
        "place": {
            "attributes": {},
            "bounding_box": {
                "coordinates": [
                    [
                        [
                            -122.45778216,
                            37.75932999
                        ],
                        [
                            -122.44248216,
                            37.75932999
                        ],
                        [
                            -122.44248216,
                            37.76752899
                        ],
                        [
                            -122.45778216,
                            37.76752899
                        ]
                    ]
                ],
                "type": "Polygon"
            },
            "country": "United States",
            "country_code": "US",
            "full_name": "Ashbury Heights, San Francisco",
            "id": "866269c983527d5a",
            "name": "Ashbury Heights",
            "place_type": "neighborhood",
            "url": "http://api.twitter.com/1/geo/id/866269c983527d5a.json"
        },
        "retweet_count": 0,
        "retweeted": false,
        "source": "Twitter for  iPhone",
        "text": "@messl congrats! So happy for all 3 of you.",
        "truncated": false
    },
    "statuses_count": 2609,
    "time_zone": "Pacific Time (US & Canada)",
    "url": null,
    "utc_offset": -28800,
    "verified": false }
有关详细信息,请参阅twitter