This topic was automatically generated from Slack. You can find the original thread here.
I am trying to use the Facebook graph sdk using the following code:
import facebook
def get_facebook_post(post_id, access_token):
# Initialize the Graph API client
graph = facebook.GraphAPI(access_token=access_token, version=“2.1”)
_# Get the post object_
post = graph.get_object(**id**=post_id)
_# Print out all of its fields_
**for** field **in** post:
**print**(f"{field}: {post[field]}")
def handler(pd: “pipedream”):
print(pd.inputs)
token = pd.inputs[“facebook_groups”][“$auth”][“oauth_access_token”]
post = get_facebook_post(pd.steps["trigger"]["event"]["id"], token)
**print**(post)
_# Return data for use in future steps_
**return** {"foo": {"test": **True**}}
I am getting inconsisten results. Sometimes it works and sometimes I get: “ModuleNotFoundError
No module named ‘facebook’”. Any idea why this is happening?