Latest Post

🚨 BẢO MẬT WEB THỜI ĐẠI AI: HACKER DÙNG AI, BẠN VẪN BẢO VỆ WEBSITE THEO CÁCH CŨ? 🚨 CẢNH BÁO BẢO MẬT: HACKER CÓ THỂ ĐANG NHẮM ĐẾN FILE config.php CHỨA MẬT KHẨU DATABASE! UEFI Package sử dụng thư viện xử lý hình ảnh có rất nhiều lỗ hỏng bảo mật. Wireless LAN Router của ELECOM có lỗ hỏng bảo mật OS Command injection Note: setting days for Crontab Launching AWS EC2 Instance using Python Tự động phát hành SSL Certificate hết hạn Let’s Encrypt Verify if crontab works Cách xem thời hạn của Let’s Encrypt SSL Certificate AWS EC2 Instance: jum update failure: repodata/repomd.xml from rpmforge: [Errno 256] No more mirrors to try. Nhập môn Python: Chương 2 Hello World thử viết chương trình python đơn giản. Python – Anaconda: Cài đặt Anaconda môi trường lập trình python Nhập môn Python: Chương 1 Python là gì? MySQL – GRANT: Tạo user, set lại password, xem và cấp quyền cho user. Python – Multithread – Queue – File: Xử lý đa luồng dùng chung dữ liệu trên cùng một file dùng hàng đợi(Queue) ⑤Ubuntu – Postfix – Dovecot : Mail server setting, một phát ăn ngay . ④Ubuntu – Postfix – Dovecot : SSL/TSL security mail server setting, một phát ăn ngay. ③Ubuntu – Postfix – Dovecot : Mail server setting, một phát ăn ngay. ②Ubuntu – Postfix – Dovecot : Mail server setting, một phát ăn ngay. ① Ubuntu – Postfix – Dovecot : Mail server setting, một phát ăn ngay. Python – Pandas: lấy data từ file csv. Newbie – Python – Selenium: Tự động login Facebook với trình duyệt Chrome Newbie – Python – Skype: Gửi Message tới Skype chat group hoặc user bằng ngôn ngữ Python. Newbie – Python – PostgreSQL: Kết nối với cơ sở dữ liêu PostgreSQL bằng ngôn ngữ Python. Newbie – Python – SQL Server: Kết nối với cơ sở dữ liệu SQL Server bằng ngôn ngữ Python. Newbie – Python – Mysql: Kết nối với cơ sở dữ liêu MySQL bằng ngôn ngữ Python. Basic Authentication Setting How to setup AWS VPN Client 【GCP】Compute Engine’s Disk Expansion Linux Commands WordPress 404 Page Error (Post)
0 0
Read Time:2 Minute, 12 Second

Mục lục

Install Driver dùng để kết nối với Skype

Để kết nối với Skype bằng python , ta dùng skpy.

Để install skpy ta thực thi câu lênh bên dưới.

Hệ điều hành Mac ,Windows hoặc là linux ta điều có thể install bằng command.

pip install skpy

Nếu version của Python là 3.x thì dùng câu lệnh dưới đây.

pip3 install skpy

 

Cách viết code Python để login vào Skype.

Để login vào Skype ta viết code như dưới đây.

from skpy import Skype

# Tạo kết nối với cơ sở dữ liêu PostgreSQL
 sk = Skype("userid", "password") # connect to Skype
  •  user:user id
  • password:password.

Tìm ID của User hoặc Group chat cần gửi Message trên Skype.

Để gửi Message tới User hoặc group chat trên skype ta phải lấy được ID của nó như code dưới đây.(Không thể dùng userID hoặc group name).

from skpy import Skype

# Xuất thôn tin của những user or group chat tham có gửi message gần đây.
 sk.chats.recent()

 

Khi thực thi đoạn code trên sẽ có kết qua như dưới đây

{'19:3767fc304b49468cb6d5407a951bf058@thread.skype': SkypeGroupChat(id='19:3767fc304b49468cb6d5407a951bf058@thread.skype', alerts=True, topic='Test-Log', creatorId='tien_skp', userIds=['tran_tam', 'chi_pheo', 'thi_no', 'mai_van', 'live:.cid.7a00af0f79c48024', 'nguyenvana', 'live:.cid.10838de924915526'], adminIds=['nguyen_h', 'tran_e', 'van_bi', 'ho_het', 'live:.cid.7a00af0f79c48024', 'van_minh', 'live:.cid.10838de92d4915526'], open=False, history=True, picture='https://api.asm.skype.com/v1/objects/0-ea-d1-0cf3ad0961fe85c5409d2b4dfsd01baa712', active=True),
 '19:e2ec4801952b432aa8a757742bab571f@thread.skype': SkypeGroupChat(id='19:e2ec4801952bd432aa8a757742bab571f@thread.skype', alerts=True, topic='OK-help', userIds=[], adminIds=[], open=False, history=False, active=False),
 '8:tien_skp': SkypeSingleChat(id='8:tien_tro', alerts=True, userId='userid_a')}

ID sẽ có format như vầy:

19:3767fc304b49468cb6d5407a951bf058@thread.skype

Kết nối với User hoặc group chat và gửi Message.

ch = sk.chats.chat('19:3767fc304b49468cb6d5407a951bf058@thread.skype')
ch.sendMsg('This is the message which sent by Python Code')

Thực thi gửi một message đơn giản đến group chat.

Thử viết một đoạn code Python đơn giản để gửi massage đến group chat.

Source Code

from skpy import Skype
sk = Skype("userid", "password") # connect to Skype
#sk.chats
#sk.chats.recent()
ch = sk.chats.chat('19:3767fc304b49468cb6d5407a951bf058@thread.skype')
ch.sendMsg('This is the message which System Log sent by Python Code')

 

Và kết quả sẽ như bên dưới

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *