Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Importing contacts from delimited files: msg#00001

cms.opengroupware.xmlrpc.devel

Subject: Re: Importing contacts from delimited files

> Adam from the users@ mailing list recommended I hop on over here for a few
> questions/help with XML-RPC scripts.
> I was told its possible and actually VERY easy to import a number of contacts
> from a delimited file using Python/XML-RPC scripts. I was wondering if
> someone
> could provide some help as to how this is actually done.

Here is one simple example -

#!/usr/bin/env python

import sys, csv, xmlrpclib, pprint
server = xmlrpclib.Server('http://{USER}:{PASSWORD}@{HOST}/RPC2')
reader = csv.reader(open("{FILENAME}", "rb"), delimiter='|',
quoting=csv.QUOTE_NONE)
for row in reader:
person = {}
person['firstname'] = row[0]
person['name'] = row[1]
person['isPrivate'] = '1'
person['extendedKeys'] = ['email1', 'title', 'other_title1']
person['extendedAttrs'] = {}
person['extendedAttrs']['email1'] = row[5]
person['extendedAttrs']['job_title'] = row[3]
person['extendedAttrs']['other_title1'] = row[2]
person['phones'] = {}
person['phones']['01_tel'] = {}
person['phones']['01_tel']['number'] = row[4]
person = server.person.insert(person)
person = server.person.getById(person)
print person

> Also, can someone recommend some information on 'PUT'ing contacts via
> Zidestore using vCard files?

You should be able to use any WebDAV client to PUT a vCard file to
ZideStore; a URL like http://{HOST}/zidestore/dav/{USERNAME}/Contacts

I mount ZideStore to the filesytsem with FUSE from my openSUSE
workstation and one can navigate the tree with cd, ls, and friends. On
Windows you should be able to do the same thing with WebDrive but I have
never tried it.

From WMOGAG:
The command “wdfs %LOCALFOLDER% -a http://%HOSTNAME%/zidestore/so/%
USERNAME%/ -u %USERNAME% -p %PASSWORD%” will mount the ZideStore folder
tree to the specified local folder. In order for normal users to mount
folders the “wdfs” binary must be set-uid.


Attachment: signature.asc
Description: This is a digitally signed message part

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo