Browse files

add a logout() function

  • Loading branch information...
1 parent c59d5d2 commit 39d65aba538067cd7a8da114e427b1f8a3096623 @pcardune pcardune committed Sep 11, 2011
Showing with 14 additions and 2 deletions.
  1. +6 −0
  2. +8 −2 src/
@@ -30,6 +30,12 @@ During the authentication process, a browser window will be opened where you can
enter in your facebook login credentials. After logging in, you can close the
browser window. Your script will continue executing in the background.
+The access token used for authentication will be stored in a file, so the next
+time your script is run, the `authenticate()` function won't have to do anything.
+To remove this access token, you can call `logout()`:
+ fbconsole.logout()
### Graph API Basics ###
@@ -147,8 +147,9 @@ def help():
The following commands are available:
help() - display this help message
-authenticate() - authenticate with facebook. Optionally provide list
- of permissions to request
+authenticate() - authenticate with facebook.
+logout() - Remove the cached access token, forcing authenticate() to get a new
+ access token
get(path, params) - call the graph api with the given path and query parameters
post(path, data) - post data to the graph api with the given path
delete(path, params) - send a delete request
@@ -186,6 +187,11 @@ def authenticate():
while ACCESS_TOKEN is None:
+def logout():
+ """Logout of facebook. This just removes the cached access token."""
+ if os.path.exists(ACCESS_TOKEN_FILE):
+ os.remove(ACCESS_TOKEN_FILE)
def get(path, params=None):
"""Send a GET request to the graph api.

0 comments on commit 39d65ab

Please sign in to comment.