コード例 #1
0
ファイル: murmur.py プロジェクト: palfrey/murmur
	output += "</ul><small>Automagically shipped by <a href=\"http://github.com/palfrey/murmur/\">Murmur</a></small></lj-cut>"
	try:
		print output
	except UnicodeEncodeError:
		print "Can't print output due to unicode issues"

	if opts.post:
		from livejournal import LiveJournal, list2list, list2mask

		subject = u"Daily mutterings"
		body = output

		username = m.config.get("livejournal","username")
		password = m.config.get("livejournal","password")
		usejournal = username

		try:
			xmlrpc = m.config.get("livejournal","xmlrpc")
			lj = LiveJournal (0, base=xmlrpc)
		except NoOptionError: # default to LJ
			lj = LiveJournal (0)
		info = lj.login (username, password)
		security = list2mask (m.config.get("livejournal","security"), info.friendgroups)

		entry = lj.postevent (unicode(body),
						subject = subject,
						security = security,
						props = {"taglist":"twitter"})

		print 'Posted'
コード例 #2
0
ファイル: ljcs.py プロジェクト: sa2ajj/ljpy
config.load (evalue ('~/.ljrc', options.config))

server = getattr (config, options.server)

username = evalue (server.username, options.username)
password = evalue (server.password, options.password)

if username is None or password is None:
    print "You must provide both user name and password"
    sys.exit (2)

lj = LiveJournal (config.misc.version)

info = lj.login (username, password)

sfrom = list2mask (options.sfrom, info.friendgroups)
sto = list2mask (options.sto, info.friendgroups)

print 'We are about to change from "%s" to "%s"' % (sfrom, sto)

if 0:
    daycounts = lj.getdaycounts ()['daycounts']

    for day in daycounts:
        # print day['date'], '->', day['count']
        events = lj.getevents ('day', day['date'])

        for event in events:
            security = getattr (event, 'security', 'public')

            if security == 'usemask':
コード例 #3
0
ファイル: ljp.py プロジェクト: sa2ajj/ljpy
    ljp = config.ljp

    username = evalue (server.username, options.username)
    password = evalue (server.password, options.password)

    if username is None or password is None:
        print "You must provide both user name and password"
        sys.exit (2)

    usejournal = evalue (None, options.journal)

    lj = LiveJournal (config.misc.version)

    info = lj.login (username, password)

    security = list2mask (options.security, info.friendgroups)

    if evalue (None, ljp.batch, options.batch):
        body = body + '\n' + sys.stdin.read ()
    else:
        # At this point we have the following variables holding useful information:
        #  -- body
        #  -- subject
        #  -- props
        #  -- usejournal
        #  -- security

        if 0:
            text = args2text (info = info, event = body, usejournal = usejournal, subject = subject, props = props, security = options.security)

            pass #  process the text