Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting graph API status code #174

Open
hasandiwan opened this issue Apr 3, 2023 · 2 comments
Open

Getting graph API status code #174

hasandiwan opened this issue Apr 3, 2023 · 2 comments

Comments

@hasandiwan
Copy link

I notice that the return value from graph.post is a CaseInsensitiveDict looking something like:

{'url': 'https://graph.facebook.com/hdiwan/feed', 'type': 'website', 'updated_time': '2023-04-03T20:41:35+0000', 'headers': {'Content-Type': 'application/json; charset=UTF-8', 'Vary': 'Origin', 'cross-origin-resource-policy': 'cross-origin', 'x-app-usage': '{"call_count":3,"total_cputime":0,"total_time":2}', 'x-fb-rlafr': '0', 'Access-Control-Allow-Origin': '*', 'facebook-api-version': 'v16.0', 'Strict-Transport-Security': 'max-age=15552000; preload', 'Pragma': 'no-cache', 'Cache-Control': 'private, no-cache, no-store, must-revalidate', 'Expires': 'Sat, 01 Jan 2000 00:00:00 GMT', 'x-fb-request-id': 'AQXW3Pr67qpWs4QSQODHm4l', 'x-fb-trace-id': 'Ge22de5mzNF', 'x-fb-rev': '1007232980', 'X-FB-Debug': 'QHZDnSMiP5eKYxBkwZQtGxpEslBFpWvNMVck965OTtsBb9EWiKepOBLoq7smeHnArHdZbC0VdPyN4UNNk+0TxA==', 'Date': 'Mon, 03 Apr 2023 20:41:36 GMT', 'Alt-Svc': 'h3=":443"; ma=86400', 'Connection': 'keep-alive', 'Content-Length': '111'}}

How would I know if my call was successful or not?

@jgorset
Copy link
Owner

jgorset commented Apr 4, 2023

Hey @hasandiwan!

Facepy should throw a FacebookError if it gets a non-200 OK status code, so that's how you'll know. Here's the code that does it: https://github.com/jgorset/facepy/blob/master/facepy/graph_api.py#L102

@hasandiwan
Copy link
Author

hasandiwan commented Apr 4, 2023

There's no exception thrown, but my status isn't updated. Will examine further and update this comment.


EDIT: Examining further, it would seem that you just return the value of request.json, and I'm not sure how to get the status code from that object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants