Facebook script


/ Published in: Python
Save to your folder(s)

How to connect to FB via fbconsole


Copy this code and paste it in your HTML
  1. #!/usr/bin/python
  2. import logging
  3. import csv
  4. import fbconsole
  5.  
  6.  
  7. logger = logging.getLogger('root')
  8. FORMAT = "[%(filename)s:%(lineno)s - %(funcName)20s() ] %(message)s"
  9. logging.basicConfig(format=FORMAT)
  10. logger.setLevel(logging.DEBUG)
  11.  
  12. def authenticate():
  13. logger.debug ('Authentication process')
  14. fbconsole.AUTH_SCOPE = ['publish_stream', 'publish_checkins']
  15. fbconsole.authenticate()
  16.  
  17.  
  18. def postMessage (msg):
  19. logger.debug (msg)
  20. status = fbconsole.post('/me/feed', {'message':msg})
  21. print status
  22.  
  23. def main():
  24. authenticate ();
  25.  
  26. if __name__ == '__main__':
  27. main()
  28. fbconsole.logout()
  29. postMessage ("3rd test")

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.