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. Android 之 Android目录

    Android的目录结构如图所示: 下面来分别说说各个目录: 1.src:存放应用程序中所有的(后台)源代码,代码的源文件一般存放在相应的包下面. 2.gen:该目录下一般有BuildConfig.j ...

  2. android kernel控制台初始化过程

    对于我们的android平台,控制台被定义到了串口1上,因此初始化过程就是把控制台的输出配置到串口1上 对kernel控制台初始化是在挂载文件系统之前,由于没有串口的设备文件,不能通过打开设备文件来访 ...

  3. iOS禁用系统休眠

    [UIApplicationsharedApplication].idleTimeDisabled= YES

  4. 选择合适的Linux版本

    以下纯属个人想法:欢迎指正 1.Linux桌面系统,首选Ubuntu.当然Ubuntu也有服务器版本,不建议使用 2.服务端的Linux稳定的服务器系统,在企业中从事运维工作Redhat或者CentO ...

  5. 笔试题之j2ee

    j2ee部分 1.BS与CS的联系与区别. C/S是Client/Server的缩写.服务器通常采用高性能的PC.工作站或小型机,并采用大型数据库系统,如Oracle.Sybase.InFORMix或 ...

  6. spring task:annotation-driven 定时任务

    1.配置文件加上<task:annotation-driven/> 2.要运行的方法前加上 @Scheduled(cron="0 00 12 1 * ?")  //每月 ...

  7. 前端开发不容错过的jQuery图片滑块插件(转)

    作为前端开发者,我们会碰到很到各种各样的jQuery插件.今天要分享的几款jQuery图片滑块插件,也就是jQuery焦点图插件,基本上会在每个网站都有应用,可以下载看看,也许你可以用到. 1.jQu ...

  8. LR基础学习_脚本信息函数

    Action(){ //脚本信息函数. //lr_whoami:返回Vuser的ID,组名称,场景ID信息./*    int id,scid;    char *vuser_group;    lr ...

  9. VMware Player 12.5.0 中文免费版

    VMWare Player优点:– 免费的 VMWare Player 体积仅90多MB,相比7百多MB且还要付费的 VMware Workstation 无疑更适合个人用户使用– 主界面清爽简洁,几 ...

  10. ORACLE 11G 利用泠备份恢复standby库

    利用泠备份恢复standby数据库 開始使用泠备份进行db恢复 2.1,停止掉standby库 SQL> shutdown immediate; Database closed. Databas ...