首页 > 代码库 > Python 提取LinkedIn用户的人脉

Python 提取LinkedIn用户的人脉

CODE:

#!/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 = http://www.mamicode.com/r'E:/eclipse/LinkedIn/dfile/linkedin_connections.json'>
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              |
+-------------------------+----------------------------+