<commit_before># coding=big5

try:
  from xml.etree import ElementTree # for Python 2.5 users
except:
  from elementtree import ElementTree
from gdata import service
import gdata
import atom
import getopt
import sys

from datetime import datetime

from blogtrans.data import *
from blogtrans.util.HTMLStripper import StripHTML

class Blogger:
  def __init__(self, email, password):
    
    self.service = service.GDataService(email, password)
    self.service.source = 'BlogTrans'
    self.service.service = 'blogger'
    self.service.server = 'www.blogger.com'
    self.service.ProgrammaticLogin()

    query = service.Query()
    query.feed = '/feeds/default/blogs'
    feed = self.service.Get(query.ToUri())
    
    self.blogids = []
    self.blognames = []
    
    # Print the results.
    print feed.title.text
    for entry in feed.entry:
      blog_id = entry.GetSelfLink().href.split('/')[-1]
      blog_name = entry.title.text
      print blog_id+"\t" + blog_name
      self.blogids.append( blog_id )
      self.blognames.append( blog_name )
      
  def SelectBlog(self, n) :
    self.blog_id = self.blogids[n]

  def CreatePost(self, article):
  
    # Create the entry to insert.
    entry = gdata.GDataEntry()
    entry.author.append(atom.Author(atom.Name(text=article.author)))

    #timetext = article.date.strftime("%Y
    # to be modified    
    # entry.published = atom.Published(text="2006-11-08T18:10:00.000-08:00")
    # entry.updated = atom.Updated(text="2006-11-08T18:10:00.000-08:00")
    
    datetext = article.date.strftime("%Y-%m-%dT%I:%M:%S.000-08:00")
    entry.published = atom.Published(datetext)
    entry.updated = atom.Updated(datetext)
   
    entry.title = atom.Title(title_type='xhtml', text=article.title)
    for category_name in article.category :
      entry.category.append(atom.Category(scheme="http://www.blogger.com/atom/ns#", term=category_name))
    entry.content = atom.Content(content_type='html', text=article.body+article.extended_body)
    
    if article.status!=article.PUBLISH :<commit_msg>just tag a new revision<commit_after># coding=big5

try:
  from xml.etree import ElementTree # for Python 2.5 users
except:
  from elementtree import ElementTree
from gdata import service
import gdata
import atom
import getopt
import sys

from datetime import datetime

from blogtrans.data import *
from blogtrans.util.HTMLStripper import StripHTML

class Blogger:
  def __init__(self, email, password):
    
    self.service = service.GDataService(email, password)
    self.service.source = 'BlogTrans'
    self.service.service = 'blogger'
    self.service.server = 'www.blogger.com'
    self.service.ProgrammaticLogin()

    query = service.Query()
    query.feed = '/feeds/default/blogs'
    feed = self.service.Get(query.ToUri())
    
    self.blogids = []
    self.blognames = []
    
    # Print the results.
    print feed.title.text
    for entry in feed.entry:
      blog_id = entry.GetSelfLink().href.split('/')[-1]
      blog_name = entry.title.text
      #blog_name = unicode(blog_name)
	  
      print blog_id+"\t" + blog_name+"\t"
      print type(blog_name)
	  
      self.blogids.append( blog_id )
      self.blognames.append( blog_name )
      
  def SelectBlog(self, n) :
    self.blog_id = self.blogids[n]

  def CreatePost(self, article):
  
    # Create the entry to insert.
    entry = gdata.GDataEntry()
    entry.author.append(atom.Author(atom.Name(text=article.author)))

    #timetext = article.date.strftime("%Y
    # to be modified    
    # entry.published = atom.Published(text="2006-11-08T18:10:00.000-08:00")
    # entry.updated = atom.Updated(text="2006-11-08T18:10:00.000-08:00")
    
    datetext = article.date.strftime("%Y-%m-%dT%I:%M:%S.000-08:00")
    entry.published = atom.Published(datetext)
    entry.updated = atom.Updated(datetext)
   
    entry.title = atom.Title(title_type='xhtml', text=article.title)
    for category_name in article.category :
      entry.category.append(atom.Category(scheme="http://www.blogger.com/atom/ns#", term=category_name))
    entry.content = atom.Content(content_type='html', text=article.body+article.extended_body)
    
    if article.status!=article.PUBLISH :
{'fraction_non_alphanumeric': 0.12747672475531152, 'fraction_numerical': 0.02530436858438768, 'mean_word_length': 3.3509865005192108, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7030515', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1374, 'n_words': 264}