Extended API documentation

Below is some added documentation that isn't in pydoc yet, although will hopefully get there eventually.

General note about strings

Note that all strings in the jppy modules are unicode. Some python libraries (eg. ldap and gdata) do not expect unicode strings and note that the equality check between basic strings and unicode strings will fail even if they both represent the same string when displayed. So in many cases one will want to call encode('utf-8') on the strings coming out of jppy.

jppy.addressBook

getPhoneLabels(self)

This method returns a list of strings that are the allowed labels for phone numbers. Each phone record contains fields "phone#" and "type#" where "#" is 1 through 7. The "phone#" key contains the phone number or email address and the corresponding "type#" key contains the type of the phone number. So you may have "phone1" = "foo@…" and "type1" = "E-mail", which means that "phone1" is an email address. In my experimentation thus far (treo 700p) phone labels has the following names: 'Work', 'Home', 'Fax', 'Other', 'Email', 'Main', 'Pager', 'Mobile'.

jppy.calendar

eventsFromDate(self, date, **kwargs)

The date parameter is expected to be a datetime.datetime object. If you have a date object, you'll need to modify it something like this:

    sync_start_datetime = datetime(sync_start_date.year, sync_start_date.month, sync_start_date.day)

Here sync_start_datetime is suitable to be passed as the date parameter.

The kwargs parameter is passed directly to the datetime.timedelta constructor.

types of values in calendar event object

A calendarEvent object as returned from the calendar object has some attributes and everything else is stored in a dictionary.

attributes

  • archived - boolean
  • busy - boolean
  • category - integer
  • deleted - boolean
  • modified - boolean
  • secret - boolean
  • unique_id - integer
  • unsaved_changes - boolean

dictionary contents

  • event - boolean - if this is an event (untimed)
  • begin - date or datetime with timezone depending on value of event
  • end - date or datetime with timezone depending on value of event
  • alarm - timedelta
  • exceptions - date
  • timezone - timezone
  • description - unicode
  • note - unicode
  • dates - dateutil.rrule.rruleset - recurring dates
  • final - date
    • if this is a recurring event, this is the "End on" date
  • location - unicode

methods