SlideShare a Scribd company logo
PyCon
May 2017: Portland, OR
BayPIGgies
Aug 2016: Mountain View, CA
Exploring Google APIs
with Python
+Wesley Chun, @wescpy
Developer Advocate
Can't wait? pip{,3} install -U google-api-python-client
AND console.developers.google.com
SF Python project night
Oct 2016: San Francisco, CA
GDG NYC meetup
Nov 2016: New York, NY
Contribute
questions at:
goo.gl/Rq6ABI
Exploring Google APIs with Python
Outline
â—Ź Overview
â—Ź Getting started
â—Ź Python
â—Ź Live demo(?)
â—Ź Wrap-up
Part I: Google APIs overview
BUT
... wait, there’s more...
Exploring Google APIs with Python
Part II: Getting Started with Google APIs
Developers Console (devconsole)
Exploring Google APIs with Python
Exploring Google APIs with Python
OAuth2 scenarios
â—Ź Varies on application type (where apps located)
â—‹ Web (server) applications
â—‹ Installed (mobile & desktop computers) apps
â—‹ Service accounts (cloud/server-to-server)
â—‹ Client-side (JavaScript) apps
â—‹ Limited-input devices (game consoles, printers, cameras, etc.)
â—‹ developers.google.com/identity/protocols/OAuth2
â—‹ TODAY: command-line script == "Installed"
Part III: Using Google APIs with Python
developers.google.com/discovery/libraries
Open source client
libraries for many
languages, not just
SIMPLE
AUTHORIZED
Which do you choose?
Simple API access
General OAuth2 process
â—Ź Goal: valid access token == 3rd-party API data access
â—Ź How OAuth2 works (in general)
â—‹ Step 1: Create OAuth2 credentials in DevConsole
â—‹ Step 2: Send credentials to get access & refresh tokens
â—‹ Step 3: Use access token to make authorized API calls
â—‹ Step 4: Access tokens expire; use refresh to get new one
â—Ź developers.google.com/identity/protocols/OAuth2
â—Ź Others will be similar (with slight differences)
Authorized API access
Part IV: Demo (live would make it interesting)
Searching YouTube for videos
Listing your files in Google Drive
Reading cells from a Google Sheet
docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
University student activity Sheet from developers.google.com/sheets/quickstart/python
Replacing text & images in Google Slides
Write your own or see
github.com/googledrive/zipextractor (JS)
Build a Node.js customized reporting tool with our
Sheets API codelab at g.co/codelabs/sheets (JS)
Check out our Node.js Markdown-to-Google Slides
sample app demoing the Slides API
github.com/googlesamples/md2googleslides (JS)
Exploring Google APIs with Python
Part V: Wrap-up
Reference
â—Ź Google Developers Console
â—‹ console.developers.google.com
â—Ź Google APIs Client Library for Python (2 & 3)
â—‹ pip{,3} install -U google-api-python-client
â—‹ developers.google.com/api-client-library/python
â–  .../python/guide/{django,google_app_engine} # special
â—Ź Other languages
â—‹ developers.google.com/discovery/libraries
Reference
â—Ź Blog post & video resources
â—‹ SETUP & BOILERPLATE
â–  API project setup: goo.gl/RbyTFD
â–  Auth boilerplate code review: goo.gl/KMfbeK
â—‹ G Suite APIs
â–  Drive: goo.gl/ZIgf8k and goo.gl/EySSQV
â–  Gmail: goo.gl/pFYUQ2
â–  Calendar: goo.gl/KuYMiq
â–  Sheets: goo.gl/N1RPwC and goo.gl/U6Oljn
â–  Slides: developers.google.com/slides/videos
â–  Sheets & Slides: goo.gl/Yb06ZC
Alternative 1
â—Ź Google Apps Script
â—‹ What is it?
â–  Executes as JavaScript in Google's cloud
■ Think “built-in” services vs. traditional API usage
â–  Convenient access to G Suite/Google Apps data
â–  Can also access other Google+external services
â–  developers.google.com/apps-script
â—‹ Videos & blog post resources
â–  developers.google.com/apps-script/guides/videos
â—Ź Apps Script intro
â—Ź Google Maps & Gmail APIs
â—Ź YouTube [Data] API
â—Ź Google Forms
Alternative 2
â—Ź What about my favorite HTTP request library?
â—‹ requests
â–  python-requests.org
â—‹ So can I use 'requests' to talk to Google APIs?
â—‹ Answer: YES, but...
â–  Not many examples out there
â–  I found one at gist.github.com/ymotongpoo/1907281
â–  BUT look at it, ~80% of code is auth{entic,oriz}ation
â–  Client Library hides most of it from you
â–  Summary: yes you can, but it'll be a DIY effort
Alternatives for other Google APIs
â—Ź Most, not all, Google APIs work with standard Client Library
â—Ź Other APIs/platforms have their own
â—‹ Google AdWords
â–  developers.google.com/adwords/api/docs/clientlibraries
â—‹ Google Maps (Web Services)
â–  developers.google.com/maps/web-services/client-library
â—‹ Google Cloud Platform
â–  cloud.google.com/python/apis
â—‹ Firebase platform (Android, iOS, Web, C++, Node.js, Java)
â–  firebase.google.com/docs/libraries
Summary
● We’ve created great tech but can’t build everything(!)
â—Ź APIs: our tech available for your apps; free?!?
â—Ź Access w/favorite dev tool via Google APIs Client Library
â—‹ Python, JavaScript (client + Node.js), Java, C#/.NET, Go,
Dart, Ruby, PHP
â—‹ Also mobile: Android (Java), iOS (Swift, Objective-C)
â—Ź Build the next great thing!
Thank you! Questions?
+Wesley Chun
google.com/+WesleyChun
@wescpy
twitter.com/wescpy
slide deck
goo.gl/SILjY7
Contribute
questions at:
goo.gl/Rq6ABI

More Related Content

What's hot (19)

PDF
Golang taipei #45 10th birthday
Evan Lin
 
PPTX
How I become Go GDE
Evan Lin
 
PDF
Git - Workshop Disruptiva
Bruno Almeida
 
PDF
DevOps Taiwan meetup #19
Len Chang
 
PDF
Flutter workshop @ bang saen 2020
Anuchit Chalothorn
 
PDF
Android build process (1)
Shubham Goyal
 
PDF
Drupal contributor HOWTO
Andriy Yun
 
PPT
Gwt training presentation
MUFIX Community
 
PDF
Flutter Workshop 2021 @ ARU
Anuchit Chalothorn
 
PDF
How to master a programming language: a Golang example"
Evan Lin
 
PDF
Javascript as a target language - GWT kickoff - part1/2
JooinK
 
PDF
Open source, What | Why | How
Nikhil Agrawal
 
PPTX
Jump into React-Native (Class 2/6)
Waqqas Jabbar
 
PPTX
Git kelvin
Kwong Wang Ho
 
PDF
You tube api overview
firenze-gtug
 
PDF
2nd Athens Android Dev Meetup: Hello Android, from zero to hello
Mando Stam
 
PPTX
Git basics
Padmavathi Tiwari
 
PPTX
Grunt
bigsilverbob
 
PDF
Develop Android app using Golang
SeongJae Park
 
Golang taipei #45 10th birthday
Evan Lin
 
How I become Go GDE
Evan Lin
 
Git - Workshop Disruptiva
Bruno Almeida
 
DevOps Taiwan meetup #19
Len Chang
 
Flutter workshop @ bang saen 2020
Anuchit Chalothorn
 
Android build process (1)
Shubham Goyal
 
Drupal contributor HOWTO
Andriy Yun
 
Gwt training presentation
MUFIX Community
 
Flutter Workshop 2021 @ ARU
Anuchit Chalothorn
 
How to master a programming language: a Golang example"
Evan Lin
 
Javascript as a target language - GWT kickoff - part1/2
JooinK
 
Open source, What | Why | How
Nikhil Agrawal
 
Jump into React-Native (Class 2/6)
Waqqas Jabbar
 
Git kelvin
Kwong Wang Ho
 
You tube api overview
firenze-gtug
 
2nd Athens Android Dev Meetup: Hello Android, from zero to hello
Mando Stam
 
Git basics
Padmavathi Tiwari
 
Grunt
bigsilverbob
 
Develop Android app using Golang
SeongJae Park
 

Similar to Exploring Google APIs with Python (20)

PDF
Introduction to serverless computing on Google Cloud
wesley chun
 
PDF
Exploring Google (Cloud) APIs with Python & JavaScript
wesley chun
 
PDF
Google's serverless journey: past to present
wesley chun
 
PDF
Introduction to Google Cloud Endpoints: Speed Up Your API Development
Colin Su
 
PDF
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
wesley chun
 
PDF
Exploring Google APIs with Python
wesley chun
 
PPTX
Google Developers Overview Deck 2015
Houssem Eddine LASSOUED
 
PDF
From zero to Google APIs: Beyond search & AI... leverage all of Google
wesley chun
 
PDF
Exploring Google (Cloud) APIs & Cloud Computing overview
wesley chun
 
PDF
Accessing Google Cloud APIs
wesley chun
 
PDF
Build with ALL of Google Cloud
wesley chun
 
PDF
Powerful Google Cloud tools for your hack
wesley chun
 
PDF
Run your code serverlessly on Google's open cloud
wesley chun
 
PDF
Google Cloud Platform Update
Ido Green
 
PDF
Mobile backends with Google Cloud Platform (MBLTDev'14)
Natalia Efimtseva
 
PDF
Exploring Google APIs with Python
wesley chun
 
PDF
Introduction to Cloud Computing with Google Cloud
wesley chun
 
PDF
Using Google (Cloud) APIs
wesley chun
 
PDF
Google Apps Script: Accessing G Suite & other Google services with JavaScript
wesley chun
 
PDF
Introduction to Google Drive API
Jomar Tigcal
 
Introduction to serverless computing on Google Cloud
wesley chun
 
Exploring Google (Cloud) APIs with Python & JavaScript
wesley chun
 
Google's serverless journey: past to present
wesley chun
 
Introduction to Google Cloud Endpoints: Speed Up Your API Development
Colin Su
 
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
wesley chun
 
Exploring Google APIs with Python
wesley chun
 
Google Developers Overview Deck 2015
Houssem Eddine LASSOUED
 
From zero to Google APIs: Beyond search & AI... leverage all of Google
wesley chun
 
Exploring Google (Cloud) APIs & Cloud Computing overview
wesley chun
 
Accessing Google Cloud APIs
wesley chun
 
Build with ALL of Google Cloud
wesley chun
 
Powerful Google Cloud tools for your hack
wesley chun
 
Run your code serverlessly on Google's open cloud
wesley chun
 
Google Cloud Platform Update
Ido Green
 
Mobile backends with Google Cloud Platform (MBLTDev'14)
Natalia Efimtseva
 
Exploring Google APIs with Python
wesley chun
 
Introduction to Cloud Computing with Google Cloud
wesley chun
 
Using Google (Cloud) APIs
wesley chun
 
Google Apps Script: Accessing G Suite & other Google services with JavaScript
wesley chun
 
Introduction to Google Drive API
Jomar Tigcal
 
Ad

More from wesley chun (20)

PDF
Deploy Basic AI web apps with Serverless Computing from Google Cloud
wesley chun
 
PDF
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
PDF
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
 
PDF
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
 
PDF
Easy path to machine learning (2023-2024)
wesley chun
 
PDF
Powerful Google developer tools for immediate impact! (2023-24 B)
wesley chun
 
PDF
Powerful Google developer tools for immediate impact! (2023-24 A)
wesley chun
 
PDF
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
PDF
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
wesley chun
 
PDF
Serverless Computing with Python
wesley chun
 
PDF
Easy path to machine learning (2022)
wesley chun
 
PDF
Google... more than just a cloud
wesley chun
 
PDF
Serverless computing with Google Cloud
wesley chun
 
PDF
Image archive, analysis & report generation with Google Cloud
wesley chun
 
PDF
Easy path to machine learning (Spring 2021)
wesley chun
 
PDF
Serverless Computing with Google Cloud
wesley chun
 
PDF
Serverless Computing with Python
wesley chun
 
PDF
Easy path to machine learning (Spring 2020)
wesley chun
 
PDF
Exploring Google (Cloud) APIs with Python & JavaScript
wesley chun
 
PDF
Google Cloud @ Hackathons (2020)
wesley chun
 
Deploy Basic AI web apps with Serverless Computing from Google Cloud
wesley chun
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
 
Easy path to machine learning (2023-2024)
wesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 B)
wesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 A)
wesley chun
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
wesley chun
 
Serverless Computing with Python
wesley chun
 
Easy path to machine learning (2022)
wesley chun
 
Google... more than just a cloud
wesley chun
 
Serverless computing with Google Cloud
wesley chun
 
Image archive, analysis & report generation with Google Cloud
wesley chun
 
Easy path to machine learning (Spring 2021)
wesley chun
 
Serverless Computing with Google Cloud
wesley chun
 
Serverless Computing with Python
wesley chun
 
Easy path to machine learning (Spring 2020)
wesley chun
 
Exploring Google (Cloud) APIs with Python & JavaScript
wesley chun
 
Google Cloud @ Hackathons (2020)
wesley chun
 
Ad

Recently uploaded (20)

PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Digital Circuits, important subject in CS
contactparinay1
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 

Exploring Google APIs with Python

  • 1. PyCon May 2017: Portland, OR BayPIGgies Aug 2016: Mountain View, CA Exploring Google APIs with Python +Wesley Chun, @wescpy Developer Advocate Can't wait? pip{,3} install -U google-api-python-client AND console.developers.google.com SF Python project night Oct 2016: San Francisco, CA GDG NYC meetup Nov 2016: New York, NY Contribute questions at: goo.gl/Rq6ABI
  • 3. Outline â—Ź Overview â—Ź Getting started â—Ź Python â—Ź Live demo(?) â—Ź Wrap-up Part I: Google APIs overview
  • 6. Part II: Getting Started with Google APIs
  • 10. OAuth2 scenarios â—Ź Varies on application type (where apps located) â—‹ Web (server) applications â—‹ Installed (mobile & desktop computers) apps â—‹ Service accounts (cloud/server-to-server) â—‹ Client-side (JavaScript) apps â—‹ Limited-input devices (game consoles, printers, cameras, etc.) â—‹ developers.google.com/identity/protocols/OAuth2 â—‹ TODAY: command-line script == "Installed"
  • 11. Part III: Using Google APIs with Python developers.google.com/discovery/libraries Open source client libraries for many languages, not just
  • 12. SIMPLE AUTHORIZED Which do you choose? Simple API access
  • 13. General OAuth2 process â—Ź Goal: valid access token == 3rd-party API data access â—Ź How OAuth2 works (in general) â—‹ Step 1: Create OAuth2 credentials in DevConsole â—‹ Step 2: Send credentials to get access & refresh tokens â—‹ Step 3: Use access token to make authorized API calls â—‹ Step 4: Access tokens expire; use refresh to get new one â—Ź developers.google.com/identity/protocols/OAuth2 â—Ź Others will be similar (with slight differences) Authorized API access
  • 14. Part IV: Demo (live would make it interesting) Searching YouTube for videos
  • 15. Listing your files in Google Drive Reading cells from a Google Sheet docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit University student activity Sheet from developers.google.com/sheets/quickstart/python
  • 16. Replacing text & images in Google Slides Write your own or see github.com/googledrive/zipextractor (JS)
  • 17. Build a Node.js customized reporting tool with our Sheets API codelab at g.co/codelabs/sheets (JS) Check out our Node.js Markdown-to-Google Slides sample app demoing the Slides API github.com/googlesamples/md2googleslides (JS)
  • 19. Part V: Wrap-up Reference â—Ź Google Developers Console â—‹ console.developers.google.com â—Ź Google APIs Client Library for Python (2 & 3) â—‹ pip{,3} install -U google-api-python-client â—‹ developers.google.com/api-client-library/python â–  .../python/guide/{django,google_app_engine} # special â—Ź Other languages â—‹ developers.google.com/discovery/libraries
  • 20. Reference â—Ź Blog post & video resources â—‹ SETUP & BOILERPLATE â–  API project setup: goo.gl/RbyTFD â–  Auth boilerplate code review: goo.gl/KMfbeK â—‹ G Suite APIs â–  Drive: goo.gl/ZIgf8k and goo.gl/EySSQV â–  Gmail: goo.gl/pFYUQ2 â–  Calendar: goo.gl/KuYMiq â–  Sheets: goo.gl/N1RPwC and goo.gl/U6Oljn â–  Slides: developers.google.com/slides/videos â–  Sheets & Slides: goo.gl/Yb06ZC Alternative 1 â—Ź Google Apps Script â—‹ What is it? â–  Executes as JavaScript in Google's cloud â–  Think “built-in” services vs. traditional API usage â–  Convenient access to G Suite/Google Apps data â–  Can also access other Google+external services â–  developers.google.com/apps-script â—‹ Videos & blog post resources â–  developers.google.com/apps-script/guides/videos â—Ź Apps Script intro â—Ź Google Maps & Gmail APIs â—Ź YouTube [Data] API â—Ź Google Forms
  • 21. Alternative 2 â—Ź What about my favorite HTTP request library? â—‹ requests â–  python-requests.org â—‹ So can I use 'requests' to talk to Google APIs? â—‹ Answer: YES, but... â–  Not many examples out there â–  I found one at gist.github.com/ymotongpoo/1907281 â–  BUT look at it, ~80% of code is auth{entic,oriz}ation â–  Client Library hides most of it from you â–  Summary: yes you can, but it'll be a DIY effort Alternatives for other Google APIs â—Ź Most, not all, Google APIs work with standard Client Library â—Ź Other APIs/platforms have their own â—‹ Google AdWords â–  developers.google.com/adwords/api/docs/clientlibraries â—‹ Google Maps (Web Services) â–  developers.google.com/maps/web-services/client-library â—‹ Google Cloud Platform â–  cloud.google.com/python/apis â—‹ Firebase platform (Android, iOS, Web, C++, Node.js, Java) â–  firebase.google.com/docs/libraries
  • 22. Summary â—Ź We’ve created great tech but can’t build everything(!) â—Ź APIs: our tech available for your apps; free?!? â—Ź Access w/favorite dev tool via Google APIs Client Library â—‹ Python, JavaScript (client + Node.js), Java, C#/.NET, Go, Dart, Ruby, PHP â—‹ Also mobile: Android (Java), iOS (Swift, Objective-C) â—Ź Build the next great thing! Thank you! Questions? +Wesley Chun google.com/+WesleyChun @wescpy twitter.com/wescpy slide deck goo.gl/SILjY7 Contribute questions at: goo.gl/Rq6ABI