A note about hitting the Facebook API with the Python SDK


#coding:utf-8
import json, urllib2
import facebook
from setting import *

def getFriendsFromperson(person_id):
    fb_friends = graph.get_connections(id=person_id, connection_name='events')
    print(fb_friends)

facebook_app_id = 'xxxxxxxx'
facebook_app_secret = 'xxxxxxxxxxxxxxx'
facebook_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxx'
facebook_tedxutokyo_event = '682438141897525'

graph = facebook.GraphAPI(facebook_access_token)
event = graph.get_object(id=facebook_tedxutokyo_event, Connection='invited')
attending = graph.get_connections(id=facebook_tedxutokyo_event , connection_name='maybe', limit= 100)
# attending2 = graph.get_connections(id=facebook_tedxutokyo_event , connection_name='attending')

persons_id = {}
persons_pictures = {}

count = 0

for person in attending['data']:
    person_name = person['name'].encode('utf-8')
    person_id = person['id'].encode('utf-8')
    persons_id[person_name] = person_id
    print(person_id)
    count += 1

print(count)

The point is to add a limit (25 defaults)

Recommended Posts

A note about hitting the Facebook API with the Python SDK
A note about the python version of python virtualenv
Call the API with python3.
A note about [python] __debug__
Note calling the CUDA Driver API with Python ctypes
I tried hitting the API with echonest's python client
Try hitting the Twitter API quickly and easily with Python
Python: A Note About Classes 1 "Abstract"
Hit the Etherpad-lite API with Python
Create a Twitter BOT with the GoogleAppEngine SDK for Python
A note about mock (Python mock library)
A story about adding a REST API to a daemon made with Python
How to send a request to the DMM (FANZA) API with python
Search the maze with the python A * algorithm
Working with OpenStack using the Python SDK
Try hitting the YouTube API in Python
A note about doing the Pyramid tutorial
Hit a method of a class instance with the Python Bottle Web API
[Python] Get the files in a folder with Python
Created a Python wrapper for the Qiita API
A Java programmer studied Python. (About the decorator)
[Note] Export the html of the site with python.
[Note] Create a one-line timezone class with python
Tips for hitting the ATND API in Python
Data analysis in Python: A note about line_profiler
A memorandum about the Python tesseract wrapper library
[Note] About the role of underscore "_" in Python
A note about the new style base class
A note about checking modifiers with Max Plus
A note about __call__
A note about subprocess
A note about mprotect (2)
A story about making 3D space recognition with Python
Playing with a user-local artificial intelligence API in Python
[Blender] Complement Blender's Python API with a text editor
Make a breakpoint on the c layer with python
A story about making Hanon-like sheet music with Python
A story about trying a (Golang +) Python monorepo with Bazel
Fill the background with a single color with OpenCV2 + Python
Register a ticket with redmine API using python requests
Create a tweet heatmap with the Google Maps API
A memo that I touched the Datastore with python
A note on speeding up Python code with Numba
A memo about building a Django (Python) application with Docker
A reminder about the implementation of recommendations in Python
[Vagrant] Set up a simple API server with python
I moved the automatic summarization API "summpy" with python3.
A little bit from Python using the Jenkins API
Python Note: The mystery of assigning a variable to a variable
Automate background removal for the latest portraits in a directory with Python and API
Second half of the first day of studying Python Try hitting the Twitter API with Bottle
A story about a Python beginner trying to get Google search results using the API
I thought about why Python self is necessary with the feeling of a Python interpreter
After hitting the Qiita API with Python to get a list of articles for beginners, we will visit the god articles
I replaced the Windows PowerShell cookbook with a python script.
Use Trello API with python
The story of implementing the popular Facebook Messenger Bot with python
Quickly take a query string with API Gateway-> Lambda (Python)
Use Twitter API with Python
The first API to make with python Djnago REST framework
About the Python module venv