Example #1
0
File: ljcs.py Project: sa2ajj/ljpy
from livejournal import LiveJournal, Config, evalue, list2mask
from livejournal.config import std_parser

parser = std_parser (usage = '%prog [options]')

parser.add_option ('-F', '--from',
                   action = 'store', type = 'string', dest = 'sfrom', default = 'public',
                   help = 'what security level change', metavar = 'SECURITY')
parser.add_option ('-T', '--to',
                   action = 'store', type = 'string', dest = 'sto', default = 'friends',
                   help = 'what security level change', metavar = 'SECURITY')

options, args = parser.parse_args ()

config = Config ()
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)
Example #2
0
File: lj.py Project: sa2ajj/ljpy
#! /usr/bin/python
# -*- coding: utf-8 -*-

'''this file is a sandbox for my experiments with differrent methods
of the LiveJournal protocol.  Though I include this file in the distribution
it should rather be used as an example...  Misha'''

from livejournal import LiveJournal, Config

config = Config ()
config.load ('~/.ljrc')

server = config.server

lj = LiveJournal (config.misc.version)

from pprint import pprint

pprint (lj.login (server.username, server.password))

if 0:
    pprint (lj.checkfriends (lastupdate = '2002-07-24 00:00:00', mask = 1))
elif 0:
    pprint (lj.getfriends (includefriendof = 1, includegroups = 1))
else:
    print 'Synchronizing...'

    value = lj.syncitems ()

    print 'Got information for %d out of %d item(s)' % (value.count, value.total)