Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding=utf-8
- from fbchat import Client
- from fbchat.models import *
- import ConfigParser # Module for configuration-file read.
- def facebook_send(username, password):
- client = Client(username, password)
- 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)
- client.logout()
- config = ConfigParser.RawConfigParser()
- config.read('facebook.properties')
- for section_name in config.sections():
- if config.has_option(section_name, 'USERNAME'):
- username = config.get(section_name, 'USERNAME')
- password = config.get(section_name, 'PASSWORD')
- facebook_send(username, password)
- else:
- print("The following parameter required:",section_name)
- ###########Külön config fájl cat facebook.properties
- #[DEFAULT]
- #USERNAME = dummy@gmail.com
- #PASSWORD = very_secret_password_123
- #THREAD_ID = 1234567891234567
- #THREAD_TYPE = ThreadType.USER
- #TEXT = This is a test TEXT
- [Devops Akadémia]
- USERNAME = mikaczopeter@freemail.hu
- PASSWORD = wrogkwrfgk
- THREAD_ID = 1867812176612833
- THREAD_TYPE = ThreadType.GROUP
- TEXT = This is a test TEXT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement