SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
Introduction to Facebook Python API
Social Network and Applications, 2011
LittleQ, The Department of Computer Science, NCCU




                                                    f
                                                         Introduction to
                                                        Facebook PY API
Objectives



•   Learn the concepts of Facebook API
•   Learn how to play with Facebook Graph
    API


                                     f
                                          Introduction to
                                         Facebook PY API
Core Topics

•   Facebook Developers website
•   Graph API
•   Facebook Python SDK
•   Resources



                                  f
                                       Introduction to
                                      Facebook PY API
Facebook Developers

•   Provide you online documentations
•   Forum for discussion
•   Management of your applications




                                      f
                                           Introduction to
                                          Facebook PY API
Where is it?




               f
                    Introduction to
                   Facebook PY API
Social Plugins


•   Like Button, Send Button, Login Button
•   Comments
•   Your Friends
•   Activity Feed, Live Stream

                                     f
                                          Introduction to
                                         Facebook PY API
Is That What You Want?



                  f
                       Introduction to
                      Facebook PY API
Graph API
              Response Data               Aggregate Information




              Access Token                    Request Data



Application                   Graph API                      Facebook Database


 •   Facebook’s core
 •   Social graph
 •   Connections


                                                                  f
                                                                       Introduction to
                                                                      Facebook PY API
Graph Model

•   Composed of objects and connections
•   Identify entities and relationships by id
•   Data will be stored with smallest spaces
    and keep being updated




                                        f
                                             Introduction to
                                            Facebook PY API
Object Model

information from graph API
   without access token




                               f
                                    Introduction to
                                   Facebook PY API
Graph Model
          information from graph API
               with access token




                f
                      Introduction to
                     Facebook PY API
Connection Model

•   All of the object in the Facebook social graph are connected
    to each other via connections

•   Objects are just like entities while connections are like
    relationship

•   For example, users, pages and groups are objects and likes,
    friends and feeds are connections




                                                       f
                                                            Introduction to
                                                           Facebook PY API
Connection Model




              f
                   Introduction to
                  Facebook PY API
Access to Graph
•   HTTP(S) Graph API
•   SDKs
    ‣   Javascript SDK

    ‣   iOS SDK

    ‣   Android SDK

    ‣   PHP SDK

    ‣   Python SDK




                         f
                              Introduction to
                             Facebook PY API
HTTP(S) Graph API

•   RESTful HTTP request & response
•   Response data-type: JSON
•   Access URL: graph.facebook.com




                                      f
                                           Introduction to
                                          Facebook PY API
HTTP(S) Graph API

http://graph.facebook.com/<id-­‐or-­‐username>



•   Request information of an object with id or username

•   id-or-username can be “me” with the access token




                                                f
                                                        Introduction to
                                                       Facebook PY API
HTTP(S) Graph API
           http://graph.facebook.com/littleq0903


Result:
    {
    	
  	
  	
  "id":	
  "1681390745",
    	
  	
  	
  "name":	
  "Colin	
  Su",
    	
  	
  	
  "first_name":	
  "Colin",
    	
  	
  	
  "last_name":	
  "Su",
    	
  	
  	
  "link":	
  "https://www.facebook.com/littleq0903",
    	
  	
  	
  "username":	
  "littleq0903",
    	
  	
  	
  "gender":	
  "male",
    	
  	
  	
  "locale":	
  "en_US"
    }



                                                             f
                                                                      Introduction to
                                                                     Facebook PY API
Access Token
•   A long string stands for the authentication of users

•   Temporary

•   The information behind the access token

    ‣ user id
    ‣ app id
    ‣ expired time
    ‣ secret


                                                  f
                                                       Introduction to
                                                      Facebook PY API
Get Access Token

•   GetMyAccess
    http://getmyaccess.heroku.com
•   It requires a permission called
    “offline_access”, so this token can be valid
    for a long time



                                       f
                                            Introduction to
                                           Facebook PY API
HTTP(S) Graph API

•   Access token should be transferred as a
    HTTP GET variable
http://graph.facebook.com/littleq0903?access_token=...


•   More information:
    developers.facebook.com/docs/reference/
    api/


                                              f
                                                   Introduction to
                                                  Facebook PY API
Python SDK



•   Let you access all features of the Graph API
•   That’s all, let’s play!


                                       f
                                            Introduction to
                                           Facebook PY API
Python SDK


•   https://github.com/facebook/python-sdk
•   Designed to support Graph API and FB
    Javascript SDK (You will learn in the future)




                                        f
                                             Introduction to
                                            Facebook PY API
Graph


•   Depends your access token
•   Everyone will have their own graph, could
    be unique




                                     f
                                          Introduction to
                                         Facebook PY API
Graph API Class
•   Fetch the graph by implement it


    import	
  facebook

    graph	
  =	
  facebook.GraphAPI()
    user	
  =	
  graph.get_object(“littleq0903”)




                                                   f
                                                        Introduction to
                                                       Facebook PY API
Authentication
       my_profile	
  =	
  graph.get_object(“me”)


•   Graph can be implemented with an access
    token

          graph	
  =	
  GraphAPI(ACCESS_TOKEN)



•   And the perspective of the graph will be
    different

                                                 f
                                                      Introduction to
                                                     Facebook PY API
Graph Methods

•   get_object, get_objects
•   get_connections
•   put_object
•   put_wall_post, put_comment, put_like
•   delete_object


                                    f
                                         Introduction to
                                        Facebook PY API
Demo



       f
            Introduction to
           Facebook PY API
Homework

•   Fetch a kind of data on the FB Graph
•   Do some statistics on it
•   Don’t Copy from others




                                      f
                                            Introduction to
                                           Facebook PY API
Q&A Time
Thanks for your listening



                            f
                                 Introduction to
                                Facebook PY API

Contenu connexe

Tendances

Havas Media Social: How not to get stuck on the treasure island
Havas Media Social: How not to get stuck on the treasure islandHavas Media Social: How not to get stuck on the treasure island
Havas Media Social: How not to get stuck on the treasure islandMathias Beke
 
Facebook's future - The Open Graph
Facebook's future - The Open GraphFacebook's future - The Open Graph
Facebook's future - The Open GraphSaint Social
 
Anne pearson interiors presentationv2
Anne pearson interiors presentationv2Anne pearson interiors presentationv2
Anne pearson interiors presentationv2SandersWalker
 
Facebook ( Open ) Graph and the Semantic Web
Facebook ( Open ) Graph and the Semantic WebFacebook ( Open ) Graph and the Semantic Web
Facebook ( Open ) Graph and the Semantic WebMatteo Brunati
 

Tendances (8)

Facebook API for iOS
Facebook API for iOSFacebook API for iOS
Facebook API for iOS
 
Havas Media Social: How not to get stuck on the treasure island
Havas Media Social: How not to get stuck on the treasure islandHavas Media Social: How not to get stuck on the treasure island
Havas Media Social: How not to get stuck on the treasure island
 
Facebook Connect
Facebook ConnectFacebook Connect
Facebook Connect
 
Facebook data analysis using r
Facebook data analysis using rFacebook data analysis using r
Facebook data analysis using r
 
SEO Outlines by SEO Consultant SRINIVAS
SEO Outlines by SEO Consultant SRINIVASSEO Outlines by SEO Consultant SRINIVAS
SEO Outlines by SEO Consultant SRINIVAS
 
Facebook's future - The Open Graph
Facebook's future - The Open GraphFacebook's future - The Open Graph
Facebook's future - The Open Graph
 
Anne pearson interiors presentationv2
Anne pearson interiors presentationv2Anne pearson interiors presentationv2
Anne pearson interiors presentationv2
 
Facebook ( Open ) Graph and the Semantic Web
Facebook ( Open ) Graph and the Semantic WebFacebook ( Open ) Graph and the Semantic Web
Facebook ( Open ) Graph and the Semantic Web
 

En vedette

Introduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDKIntroduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDKColin Su
 
Python games
Python gamesPython games
Python gamesdxbeeh
 
Introduction To Facebook: Opportunities and Challenges For The Institution
Introduction To Facebook: Opportunities and Challenges For The InstitutionIntroduction To Facebook: Opportunities and Challenges For The Institution
Introduction To Facebook: Opportunities and Challenges For The Institutionlisbk
 
RDS_Photoscan_Eval_Cloud
RDS_Photoscan_Eval_CloudRDS_Photoscan_Eval_Cloud
RDS_Photoscan_Eval_CloudRaminder Singh
 
Facebook Development for Beginners
Facebook Development for BeginnersFacebook Development for Beginners
Facebook Development for BeginnersJesse Stay
 
introduction to server-side scripting
introduction to server-side scriptingintroduction to server-side scripting
introduction to server-side scriptingAmirul Shafeeq
 
Server and Client side comparision
Server and Client side comparisionServer and Client side comparision
Server and Client side comparisionStew Duncan
 
Workshop : Facebook JavaScript SDK
Workshop : Facebook JavaScript SDKWorkshop : Facebook JavaScript SDK
Workshop : Facebook JavaScript SDKDimitar Danailov
 
Introduction to Game programming with PyGame Part 1
Introduction to Game programming with PyGame Part 1Introduction to Game programming with PyGame Part 1
Introduction to Game programming with PyGame Part 1Abhishek Mishra
 
Facebook essay ideas
Facebook essay ideasFacebook essay ideas
Facebook essay ideasLisa Shaw
 
Scripting languages
Scripting languagesScripting languages
Scripting languagesteach4uin
 
Introduction To Facebook
Introduction To FacebookIntroduction To Facebook
Introduction To Facebookguest9c21edf3
 
Professional Front End Development
Professional Front End DevelopmentProfessional Front End Development
Professional Front End Developmentnelsonmenezes
 
Web Server Hardware and Software
Web Server Hardware and SoftwareWeb Server Hardware and Software
Web Server Hardware and Softwarewebhostingguy
 

En vedette (20)

Introduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDKIntroduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDK
 
Python at Facebook
Python at FacebookPython at Facebook
Python at Facebook
 
Python for Data Science
Python for Data SciencePython for Data Science
Python for Data Science
 
Python games
Python gamesPython games
Python games
 
Introduction To Facebook: Opportunities and Challenges For The Institution
Introduction To Facebook: Opportunities and Challenges For The InstitutionIntroduction To Facebook: Opportunities and Challenges For The Institution
Introduction To Facebook: Opportunities and Challenges For The Institution
 
RDS_Photoscan_Eval_Cloud
RDS_Photoscan_Eval_CloudRDS_Photoscan_Eval_Cloud
RDS_Photoscan_Eval_Cloud
 
Facebook Development for Beginners
Facebook Development for BeginnersFacebook Development for Beginners
Facebook Development for Beginners
 
introduction to server-side scripting
introduction to server-side scriptingintroduction to server-side scripting
introduction to server-side scripting
 
Server and Client side comparision
Server and Client side comparisionServer and Client side comparision
Server and Client side comparision
 
Workshop : Facebook JavaScript SDK
Workshop : Facebook JavaScript SDKWorkshop : Facebook JavaScript SDK
Workshop : Facebook JavaScript SDK
 
Introduction to Game programming with PyGame Part 1
Introduction to Game programming with PyGame Part 1Introduction to Game programming with PyGame Part 1
Introduction to Game programming with PyGame Part 1
 
Website vs web app
Website vs web appWebsite vs web app
Website vs web app
 
Mobile app Vs Web App
Mobile app Vs Web AppMobile app Vs Web App
Mobile app Vs Web App
 
Client & server side scripting
Client & server side scriptingClient & server side scripting
Client & server side scripting
 
Facebook essay ideas
Facebook essay ideasFacebook essay ideas
Facebook essay ideas
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
 
Introduction To Facebook
Introduction To FacebookIntroduction To Facebook
Introduction To Facebook
 
Professional Front End Development
Professional Front End DevelopmentProfessional Front End Development
Professional Front End Development
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
 
Web Server Hardware and Software
Web Server Hardware and SoftwareWeb Server Hardware and Software
Web Server Hardware and Software
 

Similaire à Introduction to Facebook Python API

Facebook Open Graph Protocol and Graph API (NoVA Code Camp 2010.1)
Facebook Open Graph Protocol and Graph API (NoVA Code Camp 2010.1)Facebook Open Graph Protocol and Graph API (NoVA Code Camp 2010.1)
Facebook Open Graph Protocol and Graph API (NoVA Code Camp 2010.1)Chris Busse
 
20110611 Facebook Case Study
20110611 Facebook Case Study20110611 Facebook Case Study
20110611 Facebook Case StudyYuki MAEJIMA
 
20140505 - Victor Gau - R to access the social graph from facebook
20140505 - Victor Gau - R to access the social graph from facebook20140505 - Victor Gau - R to access the social graph from facebook
20140505 - Victor Gau - R to access the social graph from facebookVictor Gau
 
Php day 2011 - Interactive-with-facebook
Php day 2011 - Interactive-with-facebookPhp day 2011 - Interactive-with-facebook
Php day 2011 - Interactive-with-facebookQuang Anh Le
 
An introduction to mixi Graph API
An introduction to mixi Graph APIAn introduction to mixi Graph API
An introduction to mixi Graph APImixiplatform
 

Similaire à Introduction to Facebook Python API (7)

Facebook api for iOS
Facebook api for iOSFacebook api for iOS
Facebook api for iOS
 
Facebook Open Graph Protocol and Graph API (NoVA Code Camp 2010.1)
Facebook Open Graph Protocol and Graph API (NoVA Code Camp 2010.1)Facebook Open Graph Protocol and Graph API (NoVA Code Camp 2010.1)
Facebook Open Graph Protocol and Graph API (NoVA Code Camp 2010.1)
 
20110611 Facebook Case Study
20110611 Facebook Case Study20110611 Facebook Case Study
20110611 Facebook Case Study
 
20140505 - Victor Gau - R to access the social graph from facebook
20140505 - Victor Gau - R to access the social graph from facebook20140505 - Victor Gau - R to access the social graph from facebook
20140505 - Victor Gau - R to access the social graph from facebook
 
Php day 2011 - Interactive-with-facebook
Php day 2011 - Interactive-with-facebookPhp day 2011 - Interactive-with-facebook
Php day 2011 - Interactive-with-facebook
 
An introduction to mixi Graph API
An introduction to mixi Graph APIAn introduction to mixi Graph API
An introduction to mixi Graph API
 
MTSW-Facebook-1
MTSW-Facebook-1MTSW-Facebook-1
MTSW-Facebook-1
 

Plus de Colin Su

Introduction to Google Compute Engine
Introduction to Google Compute EngineIntroduction to Google Compute Engine
Introduction to Google Compute EngineColin Su
 
Introduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API DevelopmentIntroduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API DevelopmentColin Su
 
Functional programming in Python
Functional programming in PythonFunctional programming in Python
Functional programming in PythonColin Su
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code LabColin Su
 
A Tour of Google Cloud Platform
A Tour of Google Cloud PlatformA Tour of Google Cloud Platform
A Tour of Google Cloud PlatformColin Su
 
Introduction to MapReduce & hadoop
Introduction to MapReduce & hadoopIntroduction to MapReduce & hadoop
Introduction to MapReduce & hadoopColin Su
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App EngineColin Su
 
Django Deployer
Django DeployerDjango Deployer
Django DeployerColin Su
 
Introduction to Google - the most natural way to learn English (English Speech)
Introduction to Google - the most natural way to learn English (English Speech)Introduction to Google - the most natural way to learn English (English Speech)
Introduction to Google - the most natural way to learn English (English Speech)Colin Su
 
How to Speak Charms Like a Wizard
How to Speak Charms Like a WizardHow to Speak Charms Like a Wizard
How to Speak Charms Like a WizardColin Su
 
房地產報告
房地產報告房地產報告
房地產報告Colin Su
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitColin Su
 
Web Programming - 1st TA Session
Web Programming - 1st TA SessionWeb Programming - 1st TA Session
Web Programming - 1st TA SessionColin Su
 
Nested List Comprehension and Binary Search
Nested List Comprehension and Binary SearchNested List Comprehension and Binary Search
Nested List Comprehension and Binary SearchColin Su
 
Python-List comprehension
Python-List comprehensionPython-List comprehension
Python-List comprehensionColin Su
 
Python-FileIO
Python-FileIOPython-FileIO
Python-FileIOColin Su
 
Python Dictionary
Python DictionaryPython Dictionary
Python DictionaryColin Su
 
Vim editor
Vim editorVim editor
Vim editorColin Su
 
VPython introduction
VPython introductionVPython introduction
VPython introductionColin Su
 
Linux-Permission
Linux-PermissionLinux-Permission
Linux-PermissionColin Su
 

Plus de Colin Su (20)

Introduction to Google Compute Engine
Introduction to Google Compute EngineIntroduction to Google Compute Engine
Introduction to Google Compute Engine
 
Introduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API DevelopmentIntroduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API Development
 
Functional programming in Python
Functional programming in PythonFunctional programming in Python
Functional programming in Python
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code Lab
 
A Tour of Google Cloud Platform
A Tour of Google Cloud PlatformA Tour of Google Cloud Platform
A Tour of Google Cloud Platform
 
Introduction to MapReduce & hadoop
Introduction to MapReduce & hadoopIntroduction to MapReduce & hadoop
Introduction to MapReduce & hadoop
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 
Django Deployer
Django DeployerDjango Deployer
Django Deployer
 
Introduction to Google - the most natural way to learn English (English Speech)
Introduction to Google - the most natural way to learn English (English Speech)Introduction to Google - the most natural way to learn English (English Speech)
Introduction to Google - the most natural way to learn English (English Speech)
 
How to Speak Charms Like a Wizard
How to Speak Charms Like a WizardHow to Speak Charms Like a Wizard
How to Speak Charms Like a Wizard
 
房地產報告
房地產報告房地產報告
房地產報告
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Web Programming - 1st TA Session
Web Programming - 1st TA SessionWeb Programming - 1st TA Session
Web Programming - 1st TA Session
 
Nested List Comprehension and Binary Search
Nested List Comprehension and Binary SearchNested List Comprehension and Binary Search
Nested List Comprehension and Binary Search
 
Python-List comprehension
Python-List comprehensionPython-List comprehension
Python-List comprehension
 
Python-FileIO
Python-FileIOPython-FileIO
Python-FileIO
 
Python Dictionary
Python DictionaryPython Dictionary
Python Dictionary
 
Vim editor
Vim editorVim editor
Vim editor
 
VPython introduction
VPython introductionVPython introduction
VPython introduction
 
Linux-Permission
Linux-PermissionLinux-Permission
Linux-Permission
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

Dernier (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

Introduction to Facebook Python API

  • 1. Introduction to Facebook Python API Social Network and Applications, 2011 LittleQ, The Department of Computer Science, NCCU f Introduction to Facebook PY API
  • 2. Objectives • Learn the concepts of Facebook API • Learn how to play with Facebook Graph API f Introduction to Facebook PY API
  • 3. Core Topics • Facebook Developers website • Graph API • Facebook Python SDK • Resources f Introduction to Facebook PY API
  • 4. Facebook Developers • Provide you online documentations • Forum for discussion • Management of your applications f Introduction to Facebook PY API
  • 5. Where is it? f Introduction to Facebook PY API
  • 6. Social Plugins • Like Button, Send Button, Login Button • Comments • Your Friends • Activity Feed, Live Stream f Introduction to Facebook PY API
  • 7. Is That What You Want? f Introduction to Facebook PY API
  • 8. Graph API Response Data Aggregate Information Access Token Request Data Application Graph API Facebook Database • Facebook’s core • Social graph • Connections f Introduction to Facebook PY API
  • 9. Graph Model • Composed of objects and connections • Identify entities and relationships by id • Data will be stored with smallest spaces and keep being updated f Introduction to Facebook PY API
  • 10. Object Model information from graph API without access token f Introduction to Facebook PY API
  • 11. Graph Model information from graph API with access token f Introduction to Facebook PY API
  • 12. Connection Model • All of the object in the Facebook social graph are connected to each other via connections • Objects are just like entities while connections are like relationship • For example, users, pages and groups are objects and likes, friends and feeds are connections f Introduction to Facebook PY API
  • 13. Connection Model f Introduction to Facebook PY API
  • 14. Access to Graph • HTTP(S) Graph API • SDKs ‣ Javascript SDK ‣ iOS SDK ‣ Android SDK ‣ PHP SDK ‣ Python SDK f Introduction to Facebook PY API
  • 15. HTTP(S) Graph API • RESTful HTTP request & response • Response data-type: JSON • Access URL: graph.facebook.com f Introduction to Facebook PY API
  • 16. HTTP(S) Graph API http://graph.facebook.com/<id-­‐or-­‐username> • Request information of an object with id or username • id-or-username can be “me” with the access token f Introduction to Facebook PY API
  • 17. HTTP(S) Graph API http://graph.facebook.com/littleq0903 Result: {      "id":  "1681390745",      "name":  "Colin  Su",      "first_name":  "Colin",      "last_name":  "Su",      "link":  "https://www.facebook.com/littleq0903",      "username":  "littleq0903",      "gender":  "male",      "locale":  "en_US" } f Introduction to Facebook PY API
  • 18. Access Token • A long string stands for the authentication of users • Temporary • The information behind the access token ‣ user id ‣ app id ‣ expired time ‣ secret f Introduction to Facebook PY API
  • 19. Get Access Token • GetMyAccess http://getmyaccess.heroku.com • It requires a permission called “offline_access”, so this token can be valid for a long time f Introduction to Facebook PY API
  • 20. HTTP(S) Graph API • Access token should be transferred as a HTTP GET variable http://graph.facebook.com/littleq0903?access_token=... • More information: developers.facebook.com/docs/reference/ api/ f Introduction to Facebook PY API
  • 21. Python SDK • Let you access all features of the Graph API • That’s all, let’s play! f Introduction to Facebook PY API
  • 22. Python SDK • https://github.com/facebook/python-sdk • Designed to support Graph API and FB Javascript SDK (You will learn in the future) f Introduction to Facebook PY API
  • 23. Graph • Depends your access token • Everyone will have their own graph, could be unique f Introduction to Facebook PY API
  • 24. Graph API Class • Fetch the graph by implement it import  facebook graph  =  facebook.GraphAPI() user  =  graph.get_object(“littleq0903”) f Introduction to Facebook PY API
  • 25. Authentication my_profile  =  graph.get_object(“me”) • Graph can be implemented with an access token graph  =  GraphAPI(ACCESS_TOKEN) • And the perspective of the graph will be different f Introduction to Facebook PY API
  • 26. Graph Methods • get_object, get_objects • get_connections • put_object • put_wall_post, put_comment, put_like • delete_object f Introduction to Facebook PY API
  • 27. Demo f Introduction to Facebook PY API
  • 28. Homework • Fetch a kind of data on the FB Graph • Do some statistics on it • Don’t Copy from others f Introduction to Facebook PY API
  • 29. Q&A Time Thanks for your listening f Introduction to Facebook PY API