Advertisement
Guest User

facebook

a guest
Feb 24th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.24 KB | None | 0 0
  1. # coding=utf-8
  2. from fbchat import Client
  3. from fbchat.models import *
  4. import ConfigParser # Module for configuration-file read.
  5.  
  6.  
  7. def facebook_send(username, password):
  8.     client = Client(username, password)
  9.     client.send(Message(text=' ///UTF-8 teszt/// -- Automatikus üzenet -- Új anyag került feltöltésre a hundevops.kacsadns.org (kacsa = duck) oldalra.'), thread_id=1867812176612833, thread_type=ThreadType.GROUP)
  10.     client.logout()
  11.  
  12. config = ConfigParser.RawConfigParser()
  13. config.read('facebook.properties')
  14. for section_name in config.sections():
  15.     if config.has_option(section_name, 'USERNAME'):
  16.         username = config.get(section_name, 'USERNAME')
  17.         password = config.get(section_name, 'PASSWORD')
  18.         facebook_send(username, password)
  19.     else:
  20.         print("The following parameter required:",section_name)
  21.  
  22.  
  23.  
  24.  
  25.  
  26. ###########Külön config fájl cat facebook.properties
  27.  
  28.  
  29. #[DEFAULT]
  30. #USERNAME = dummy@gmail.com
  31. #PASSWORD = very_secret_password_123
  32. #THREAD_ID = 1234567891234567
  33. #THREAD_TYPE = ThreadType.USER
  34. #TEXT = This is a test TEXT
  35.  
  36. [Devops Akadémia]
  37. USERNAME = mikaczopeter@freemail.hu
  38. PASSWORD = wrogkwrfgk
  39. THREAD_ID = 1867812176612833
  40. THREAD_TYPE = ThreadType.GROUP
  41. TEXT = This is a test TEXT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement