CODE:

#!/usr/bin/python
# -*- coding: utf-8 -*- '''
Created on 2014-8-28
@author: guaguastd
@name: login.py
''' # Request over http
def google_login_http(resource_type, action, field): # import requests
import requests
import re # key information
key = '' # base url
url = 'https://www.googleapis.com/plus/v1' # build standard field
for matStr,repStr in [[" ", "+"], ["'", "%27"]]:
reobj = re.compile(matStr)
field = reobj.sub(repStr, field) # Build the urls
urls = '%s/%s?%s=%s&alt=json&key=%s' % (url, resource_type, action, field, key)
print 'urls: ', urls # Get the content
content = requests.get(urls, verify=False).json() # return
return content
#!/usr/bin/python
# -*- coding: utf-8 -*- '''
Created on 2014-8-22
@author: guaguastd
@name: search_for_person.py
''' import json #import login
from login import google_login_http while True:
query = raw_input("Input query(None to quit): ")
if query.strip() == '':
break people_feed = google_login_http("people", "query", query)
#people_feed = google_api.people().search(query=query).execute()
print json.dumps(people_feed['items'], indent=1)

RESULT:

Input query(None to quit): Tim O'Reilly
[
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/+TimOReilly",
"image": {
"url": "https://lh4.googleusercontent.com/-J8nmMwIhpiA/AAAAAAAAAAI/AAAAAAACoLI/_eGkAvDl1Lg/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/gVEWOJe4zmELXPIOBGB2zJT77YY\"",
"id": "107033731246200681024",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/112971313488103174611",
"image": {
"url": "https://lh4.googleusercontent.com/-DHPPpI53zYs/AAAAAAAAAAI/AAAAAAAAAA0/pMnv4IOHinM/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/-tQMA-kdju1h40Q9yqHvt_XGcI8\"",
"id": "112971313488103174611",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/115665711705516993369",
"image": {
"url": "https://lh3.googleusercontent.com/-ykapO9VSsmU/AAAAAAAAAAI/AAAAAAAAAGE/QjNpGPy5SIc/photo.jpg? sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/0z-EwRK70ma_SgL89TnXDnNCeg4\"",
"id": "115665711705516993369",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "TIM O'REILLY",
"url": "https://plus.google.com/112630513029834463088",
"image": {
"url": "https://lh3.googleusercontent.com/-dOC3TnU5LJk/AAAAAAAAAAI/AAAAAAAACXA/zxEC3Q2samc/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/kcitEq1pVj3GQMicyWbxqUM9vXc\"",
"id": "112630513029834463088",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/117480952841562724952",
"image": {
"url": "https://lh6.googleusercontent.com/-bpWGUQXAWg0/AAAAAAAAAAI/AAAAAAAAAIs/fCBaH6ldLXU/photo.jpg? sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/fbrFj4lJ_cpWx9pUUmO6476cZtY\"",
"id": "117480952841562724952",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/103336854217201973281",
"image": {
"url": "https://lh4.googleusercontent.com/-J3iV2F3ex4E/AAAAAAAAAAI/AAAAAAAAAIA/DJKY_V0epG8/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/0dlnI0n2qoODg63r8NG6Xobol8I\"",
"id": "103336854217201973281",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/102467783732787713430",
"image": {
"url": "https://lh4.googleusercontent.com/-P2nQYJTUZY8/AAAAAAAAAAI/AAAAAAAAAAA/b1obv1Rgmg4/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/H3_JCPzhKdR_ZptxJRHGswnL018\"",
"id": "102467783732787713430",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Timothy O'Reilly",
"url": "https://plus.google.com/+TimothyOReilly",
"image": {
"url": "https://lh3.googleusercontent.com/-TdJsE6Qsxzg/AAAAAAAAAAI/AAAAAAAAAis/4ltdyyk61mQ/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/3744uM_v9M6mz9icJoOhqz08cPs\"",
"id": "107415629896108700526",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/106492472890341598734",
"image": {
"url": "https://lh3.googleusercontent.com/-S5DUz4QdL4k/AAAAAAAAAAI/AAAAAAAAAMU/_MARUPifxP4/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/3mHGPwEpTqJTOYMLD8ZTGXAFHxE\"",
"id": "106492472890341598734",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Timothy O'Reilly",
"url": "https://plus.google.com/104189405442379396369",
"image": {
"url": "https://lh4.googleusercontent.com/-JY0W6EiqN6k/AAAAAAAAAAI/AAAAAAAAD8I/ecdZSHwsiQk/photo.jpg? sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/YxUJ7XitqA_et4VyLmje5-UZbGM\"",
"id": "104189405442379396369",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/106680419484587025186",
"image": {
"url": "https://lh3.googleusercontent.com/-5wQu1d4wF2w/AAAAAAAAAAI/AAAAAAAAAKA/OqGwRWaeVFI/photo.jpg? sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/-a3tNtNGvyUhChUVfGHHROC16Zo\"",
"id": "106680419484587025186",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "TIM O'REILLY",
"url": "https://plus.google.com/110160587587635791009",
"image": {
"url": "https://lh4.googleusercontent.com/-gWq9vr_JEnc/AAAAAAAAAAI/AAAAAAAAADI/zwCXKP4QeiU/photo.jpg? sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/ofg-30rIv-rKw7XTBBnDA1i3I_Y\"",
"id": "110160587587635791009",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/116668755775044955466",
"image": {
"url": "https://lh5.googleusercontent.com/-vp_eOqn1RDo/AAAAAAAAAAI/AAAAAAAAAGw/kLYoiV8nPeY/photo.jpg? sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/ACiNfQOxMSKzzyGcb5jM5bmxl6I\"",
"id": "116668755775044955466",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Timothy O'Reilly",
"url": "https://plus.google.com/107786179585502589799",
"image": {
"url": "https://lh6.googleusercontent.com/-VyqOCKcFBVg/AAAAAAAAAAI/AAAAAAAAACg/ccaDhAaSOrk/photo.jpg? sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/Dli96fXA5CodkDI-t66PRnrQFJU\"",
"id": "107786179585502589799",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Timothy O'Reilly",
"url": "https://plus.google.com/102994447097932477991",
"image": {
"url": "https://lh6.googleusercontent.com/-AN65SwKBkAA/AAAAAAAAAAI/AAAAAAAAAFI/oYk5S6oRSRM/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/ZGOPPF5KIorb7COpKZ97WBd0bNc\"",
"id": "102994447097932477991",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/103354252176309484961",
"image": {
"url": "https://lh5.googleusercontent.com/-_isKE1mWRt0/AAAAAAAAAAI/AAAAAAAAABM/36dDkRiYvBk/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/GR12dQs7rTeDOnnHnSZOHFC42Ao\"",
"id": "103354252176309484961",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Timothy O'Reilly",
"url": "https://plus.google.com/110507132467773975582",
"image": {
"url": "https://lh5.googleusercontent.com/-tDB-zaAAuD0/AAAAAAAAAAI/AAAAAAAAACY/48R4BFSJ-XQ/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/rgBrNe4FFc6FOl45g_dcf8Cx5ag\"",
"id": "110507132467773975582",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/114402115097637564691",
"image": {
"url": "https://lh5.googleusercontent.com/-ur8ek-VIzeE/AAAAAAAAAAI/AAAAAAAAAMw/JboA3pGeGM4/photo.jpg? sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/UIRX0od1spatTgp8b_Et5uyxpXM\"",
"id": "114402115097637564691",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/100454277852249756307",
"image": {
"url": "https://lh6.googleusercontent.com/-wYYn4xPXt-s/AAAAAAAAAAI/AAAAAAAAACQ/rXE2GVPnCTM/photo.jpg? sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/JIKcTr6TRO2TcSlLy6jl_kZ68yA\"",
"id": "100454277852249756307",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/103096937174083026967",
"image": {
"url": "https://lh3.googleusercontent.com/-gVHQA9qDFQ4/AAAAAAAAAAI/AAAAAAAAAAA/wEAfdMcxEX4/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/JupbCFJJqLSOZYsnRCbDMibJ308\"",
"id": "103096937174083026967",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Tim O'Reilly",
"url": "https://plus.google.com/114172069562252200235",
"image": {
"url": "https://lh5.googleusercontent.com/-3xPm1RmotzY/AAAAAAAAAAI/AAAAAAAAAC0/_Ue0ROpAMJk/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/mgTUB4vuFDnN35OV-TfovLuk42c\"",
"id": "114172069562252200235",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Timothy O'Reilly",
"url": "https://plus.google.com/101557961285050424605",
"image": {
"url": "https://lh5.googleusercontent.com/-lTaqhOsfcxw/AAAAAAAAAAI/AAAAAAAAEHM/FLiBXUD0-bk/photo.jpg? sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/cfMaCQrodj65T59aCWRTZDG1XGU\"",
"id": "101557961285050424605",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Timothy O'Reilly",
"url": "https://plus.google.com/113556773460517050463",
"image": {
"url": "https://lh6.googleusercontent.com/-u22u7FNC4Ak/AAAAAAAAAAI/AAAAAAAAAHE/LjpQ7kqjL2g/photo.jpg? sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/CGEFZv3-qj3jyGLoz4x7MCBUsp4\"",
"id": "113556773460517050463",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Timothy O'Reilly",
"url": "https://plus.google.com/109370454456340755312",
"image": {
"url": "https://lh4.googleusercontent.com/-5WtmN0-NptY/AAAAAAAAAAI/AAAAAAAAABM/UrEmKNnkczk/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/kvne_6PcngEbH44gXZT5c5_aewc\"",
"id": "109370454456340755312",
"objectType": "person"
},
{
"kind": "plus#person",
"displayName": "Timothy O'Reilly",
"url": "https://plus.google.com/106943606032560183935",
"image": {
"url": "https://lh3.googleusercontent.com/-W6NwjvPOcR8/AAAAAAAAAAI/AAAAAAAAABM/2dcYJDcixcQ/photo.jpg?sz=50"
},
"etag": "\"pNz5TVTpPz2Rn5Xw8UrubkkbOJ0/WYHhEYNT2FuI9bHkE_5ZyhwF7Q0\"",
"id": "106943606032560183935",
"objectType": "person"
}
]
Input query(None to quit):

Python 訪问Google+ (http)的更多相关文章

  1. python訪问redis

    python訪问redis 1 Linux上安装redis a) 下载 $ wget http://download.redis.io/releases/redis-3.0.5.tar.gz b) 编 ...

  2. 搜索学术论文訪问google的能用的几个IP地址

    google搜索引擎打不开时的解决的方法,谷歌(google)的IP是多少? google IP镜像. 这里搜集了几个经过測试可用的IP,用来在不能域名訪问google的时候进行訪问 更新一个最新的. ...

  3. 用上Google才是正事 分享几个訪问Google的IP和域名

    通过VPN或者GAE等代理进行訪问,GAE下载请移步<GAE 3.1.18 最新版本号下载 用上Google才是正事>.这是大家通经常使用的办法.也有同学们不愿意使用代理软件.那今天来分享 ...

  4. python 訪问webservice

    <span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255) ...

  5. Python 訪问 LinkedIn (API)

    CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-8-16 @author: guaguastd @name: l ...

  6. [Python爬虫] Selenium自己主动訪问Firefox和Chrome并实现搜索截图

    前两篇文章介绍了安装.此篇文章算是一个简单的进阶应用吧.它是在Windows下通过Selenium+Python实现自己主动訪问Firefox和Chrome并实现搜索截图的功能. [Python爬虫] ...

  7. Kivy A to Z -- 怎样从python代码中直接訪问Android的Service

    在Kivy中,通过pyjnius扩展能够间接调用Java代码,而pyjnius利用的是Java的反射机制.可是在Python对象和Java对象中转来转去总让人感觉到十分别扭.好在android提供了b ...

  8. python文件和文件夹訪问File and Directory Access

    http://blog.csdn.net/pipisorry/article/details/47907589 os.path - Common pathname manipulations 都是和路 ...

  9. Linux 终端訪问 FTP 及 上传下载 文件

    今天同事问我一个问题,在Linux 下訪问FTP,并将文件上传上去. 我之前一直是用WinSCP工具的. 先将文件从linux copy到windows下,然后在传到ftp上. google 一下. ...

随机推荐

  1. Asp.Net 之 <%%>相关内联代码块用法

    1.<%@ ... %> 用来添加命名空间引用,如:<%@ import namespace="system.data"> 2.<% ... %> ...

  2. Firefox 之 应用小结

    1. 调试脚本       做前端开发的朋友应该对FireFox再熟悉不过了,FireFox有一个附加组件FireBug.在HTML中可以直接写   <script type="tex ...

  3. mac 连接windows 共享内容

    mac 连接windows 共享内容 一:场景 在win7上下载了一个5G左右的系统文件,想弄到mac上,本打算用使用U盘,把文件从win7copy到mac电脑上: 可是U盘的分区是fat的,大于4G ...

  4. iOS判断日期A是否在日期B到日期C之间

    方法一: 可以用nsdate 的 timeIntervalSince1970 方法把时间转换成时间戳进行比较,这里timeIntervalSince1970返回的是NSTimeInterval(dou ...

  5. 子查询三(在FROM子句中使用子查询)

    FROM子句中使用子查询一般都是返回多行多列,可以将其当作一张数据表 示例一.查询出每个部门的编号,名称,位置,部门人数,平均工资 SELECT d.deptno,d.dname,d.loc,temp ...

  6. 解决org/sonarsource/scanner/maven/SonarQubeMojo : Unsupported major.minor version 52.0

    ide jdk 版本换成对应的 如:sonarqube-6.3  --> jdk1.8

  7. Knockout.js 数据验证之插件版和无插件版

    本文我们将介绍使用 Knockout.js 实现一些基本的数据验证.就如我们在标题里提到的,我们会使用两种方法来创建数据验证方法. 使用自定义方法,不需要任何插件 最简单的方法是使用已有的插件 如果你 ...

  8. python之函数用法isinstance()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法isinstance() #isinstance() #说明:返回一个布尔值,判断数据 ...

  9. DevExpress添加Winform窗体到DockPanel

    在使用DevExpress过程中,原先已经创建好的导航窗体,如何添加到DockPanel中进行展示? FormX frmX = new FormX(); frmX.Show(this.DockPane ...

  10. @Autowired(required = false)

    标记在 方法上的时候,它会根据类型去spring容器中寻找 对于的形参并且注入. @Repository(value="userDao") public class UserDao ...