Skip to content.

kagome.lab.tkikuchi.net

Sections
Personal tools
You are here: Home » Members » tkikuchi's Home » 使い方など » Ploneにまとめてユーザ登録
Views

Ploneにまとめてユーザ登録

Document Actions
こんな Python スクリプトがつかえるかもしれない。
# -*- coding: cp932 -*-
#
import time
from urllib import urlopen, urlencode

registerurl = 'http://host.example.net/join_form'

now = time.strftime('%Y/%m/%d %H:%M:%S GMT+9', time.localtime())

submits = {'last_visit:date': now,
           'prev_visit:date': now,
           'fullname':        '日暮かごめ',
           'username':        'kagome',
           'email':           'kagome@example.jp',
           'password':        'inuyasha',
           'confirm':         'inuyasha',
           'submit':          'register',
           'form.submitted':  '1',
           }

datafile = 'register.txt'
for d in file(datafile):
    username, fullname, email, password = d.strip().split(':')
    fullname = unicode(fullname, 'cp932').encode('utf-8')
    submits['username'] = username
    submits['fullname'] = fullname
    submits['email']    = email
    submits['password'] = password
    submits['confirm']  = password
    data = urlencode(submits)
    f = urlopen(registerurl, data)
    f.close()
    time.sleep(5)
time.sleep() は、サーバの負荷を考えて入れてるが、そんなには必要ないかもしれない。

ユーザデータファイルはこんな形で入れておく。

kagome:日暮かごめ:kagome@example.jp:inuyasha
akane:天道あかね:akane@example.jp:ranma1/2
Created by tkikuchi
Last modified 2005-07-15 16:17
 

Powered by Plone

This site conforms to the following standards: