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. 1423 Greatest Common Increasing Subsequence (LCIS)

    讲解摘自百度; 最长公共上升子序列(LCIS)的O(n^2)算法? 预备知识:动态规划的基本思想,LCS,LIS.? 问题:字符串a,字符串b,求a和b的LCIS(最长公共上升子序列).? 首先我们可 ...

  2. jQuery Mobile的学习时间bottonbutton的事件学习

    程序猿都非常懒.你懂的! 生命的绝唱来机仅仅争朝夕,如诗的年华更需惜时如金. 不要让今天的懈怠成为一生的痛. 每天都在进步. 近期在学习jquery mobile开发.使用的button,绑定事件,和 ...

  3. vue 开发中的常见问题

    (一)eslint静态检查 在大家用vue-cli创建工程的时候,会有一项,使用使用eslint,如果选择了y,那么工程就会安装并启用eslint. 这里列举一下常见的错误: 1.多余的分号 2.定义 ...

  4. linux下sar tool command note

    linux下的sar工具简介 我习惯使用的命令是 : sar  -r  -f   /var/log/sa/sa24 sar 既能报告当前数据,也能报告历史数据 不带选项执行会以10分钟为间隔报告自午夜 ...

  5. 山东省赛-博弈-Game

     id=1582" target="_blank" style="font-size:18px">点击打开题目链接  非常明显的一道博弈题目,可 ...

  6. HDU 5402 Travelling Salesman Problem(棋盘染色 构造 多校啊)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5402 Problem Description Teacher Mai is in a maze wit ...

  7. 基础url、相对url、绝对url

    #基础url.相对url.绝对url #HTTP权威指南 34页 •绝对URL:包含了访问资源所需的全部信息,如:http://www.163.com/new.html •相对URL:去除基础的部分, ...

  8. php 5.3 垃圾回收

    1.引用计数器 php中的每个变量都存在一个zval的变量容器中, zval容易包括变量类型.值.is_ref(是否是引用).refercount(引用次数,也成为符号), 所有的符号存在一个符号表中 ...

  9. 老男孩Linux.shell.RHCE运维初中高级50G附解压密码

    学习Linux,好的教程.使学习事半功倍! 老男孩Linux.shell.RHCE运维初中高级 下载地址: http://pan.baidu.com/s/1hsQOb2W 密码: h4hs 解压密码: ...

  10. IT忍者神龟之 oracle行转列、列转行

    一.行转列 须要将例如以下格式 转换为: 这就是最常见的行转列,主要原理是利用decode函数.聚集函数(sum).结合group by分组实现的 create table test( id varc ...