Python 提取LinkedIn用户的人脉
2014-08-18 06:06
141 查看
CODE:
RESULT:
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-8-18 @author: guaguastd @name: linkedin_connection_retrieve.py ''' # import login from login import linkedin_login # import json import json from prettytable import PrettyTable # access to linkedin api linkedin_api = linkedin_login() connections = linkedin_api.get_connections() connections_data = r'E:\eclipse\LinkedIn\dfile\linkedin_connections.json' # Write connections into disk file f = open(connections_data, 'w') f.write(json.dumps(connections, indent=1)) f.close() # Read data from disk file connections = json.loads(open(connections_data).read()) # Print the connections #print json.dumps(connections, indent=1) pt = PrettyTable(field_names=['Name', 'Location']) pt.align = 'l' [pt.add_row((c['firstName'] + ' ' + c['lastName'], c['location']['name'])) for c in connections['values'] if c.has_key('location')] print pt
RESULT:
+-------------------------+----------------------------+ | Name | Location | +-------------------------+----------------------------+ | 飞 黄 | Beijing City, China | | James Liao | San Francisco Bay Area | | Gerald Soparkar | San Francisco Bay Area | | Dimitrios Kouzis-Loukas | Birmingham, United Kingdom | | Xiaodong Xu | Beijing City, China | | Xinsong Li | China | | 科技 后院 | Chengdu, Sichuan, China | | 彦超 胡 | Xingtai, Hebei, China | | 诺克 埃 | Beijing City, China | | Zhang Jason | Beijing City, China | | qu Sisyphus | United States | | 洪林 张 | Foshan, Guangdong, China | | beyond Bzhou | United States | +-------------------------+----------------------------+
相关文章推荐
- Python 聚类分析LinkedIn用户人脉网络
- Python 提取Twitter用户的个人简介
- Python 显示LinkedIn用户的工作岗位
- 贴吧大召唤术——Python实现提取贴吧页面的用户id
- Python 规范化LinkedIn用户的联系人所在公司后缀 (data normalization)
- Python 摘录LinkedIn用户联系人
- Python 显示LinkedIn用户作业
- Python 提取Twitter用户的Tweet
- python通用论坛正文提取\python论坛评论提取\python论坛用户信息提取
- Python 提取Twitter特定话题中转载tweet的用户
- Python 规范化LinkedIn用户联系人的职位名
- Python 对LinkedIn用户联系人的地址进行地理编码
- Python 规范化LinkedIn用户联系人的职位名
- 使用Python正则表达式提取搜索结果中的站点
- Python脚本如何获取当前环节和用户等信息
- 非root用户安装 Python + MySQLdb 及使用
- 基于python的邮件地址提取小程序
- 用于提取纯真数据库IP地址列表的python小程序(使用正则表达式)
- 提取aspnet_Profile中自定义的用户属性(C#实现)
- Linux非root用户下安装了python及MySQLdb