Rolly Maulana Awangga :: Catatan Ngoprek IT

Pakar dan Awam sama saja, sama sama belajar

Category Archives: Python

Python Outlook(Microsoft email service) IMAP4 Library

Python Library to read email from live, hotmail, outlook or any microsoft email service, just dowload to yout python script folder. This library using Imaplib python to read email with IMAP protocol.

go here : https://github.com/awangga/outlook

Example

To get latest Unread Message in inbox :

import outlook
mail = outlook.Outlook()
mail.login('emailaccount@live.com','yourpassword')
mail.inbox()
print mail.unread()

To get latest Unread Message in Junk :

import outlook
mail = outlook.Outlook()
mail.login('emailaccount@live.com','yourpassword')
mail.junk()
print mail.unread()

Retrive email element :

print mail.mailbody()
print mail.mailsubject()
print mail.mailfrom()
print mail.mailto()

Django dengan CouchDB

Django merupakan salah satu web framework yang menggunakan bahasa pemrograman Python.

okeh, pertama kali kita ikutin dahulu beberapa referensi disini :

1. http://www.kaskus.co.id/thread/52e8007f38cb17542e8b459e/reborn-django-web-framework

2. http://django.or.id/2010/12/6/membuat-poll-sederhana-dengan-django/

3. http://leok.me/2013/05/02/what-you-need-to-know-couchdb-django.html

 

Python Beginner : Mysql Query

Start with this tutorials

http://ianhowson.com/a-quick-guide-to-using-mysql-in-python.html

i create script

import MySQLdb
import gc
gc.collect()

db = MySQLdb.connect(host=”localhost”, # your host, usually localhost
user=”user”, # your username
passwd=”password”, # your password
db=”db”) # name of the data base

# you must create a Cursor object. It will let
# you execute all the queries you need
cur = db.cursor()

# Use all the SQL you like
cur.execute(“SELECT * FROM db where status=3”)
hasil=cur.fetchone()
db.close()

id_ref = hasil[0]
timestamp_req = hasil[1]
file_path = hasil[2]
status = hasil[3]
secret_code = hasil[4]
id_user = hasil[5]
id_user_acc = hasil[6]
timestamp_acc = hasil[7]
message = hasil[8]
tahun = hasil[9]

print file_path
print “perintah untuk pengambilan data db sudah ok”

%d blogger menyukai ini: