Giter Site home page Giter Site logo

ical-to-json's Introduction

iCal to JSON

Version 1.2.0

Version 1.2.0 Updates

  • Removed iCalSettings. autoReadableDate and autoRemovePastEvents settings are now passed in the iCal constructor.
  • Removed iCalSettings errors.
  • Added setters and getters for settings
  • Added getter for raw iCal data
  • Fixed typo in error definitions
  • Updated example to reflect affected changes

This class allows you to take iCal data and turn it into a JSON format. This version supports the following calendar events:

Calendar Events
VEVENT
VTIMEZONE
STANDARD
DAYLIGHT
VALARM
VTODO
VJOURNAL
VFREEBUSY

Required Imports:

Imports
json
requests
os
typing
datetime

See example.py, or the documentation for help.

Documentation

iCal

When constructing up the iCal object, you can specify some settings. These also come with setter and getter methods.

autoReadableDate: Boolean. If True, any loaded iCal data will automatically have human readable dates added to it.

Defaults to False

Set value with set_setting("autoReadableDate", value: bool)

Get value with get_settings("autoReadableDate")

autoRemovePastEvents: Boolean. If True, any loaded iCal data will automatically have expired events removed from it.

Defaults to False

Set value with set_setting("autoRemovePastEvents", value: bool)

Get value with get_settings("autoRemovePastEvents")

You can also load your iCal data into the constructor.

rawiCal: String. Raw iCal data, i.e. non-edited iCal data, otherwise an ICALLoadError error will be thrown.

Defaults to None or ""

Set value with load_iCal(iCal: str) (see below)

Get value with get_raw_ical()

get_json()

Returns the iCal data in its current state.

convert_times()

Adds more human readable dates to each event.

load_iCal(iCal:str)

Loads new iCal data. This must be raw iCal data, i.e. non-edited iCal data, otherwise an ICALLoadError error will be thrown.

load_iCal_from_url(url:str)

Loads new iCal data from a URl. This website must return raw iCal data otherwise an ICALLoadError error will be thrown.

remove_past_events()

Removes all events if their end time is in the past.

save_JSON(fileName:str, Optional:filePath:str)

Saves the currently loaded data in a json file.

Exceptions

ICALNotLoaded

Raised if a method has been called that requires loaded iCal data, but no iCal data is loaded.

ICALLoadError

Raised if the iCal data is of the wrong type, or it is formatted in an unexpected/invalid way.

ICALLoadErrorWP

Raised if the iCal data from the specified URL is of the wrong type, or it is formatted in an unexpected/invalid way. This also gives the status codes of the request when raised.

ICALInvalidURL

Raised if there was an error connecting to the URL

ical-to-json's People

Contributors

abaddlesmere avatar

Stargazers

Ingolf Wagner avatar

Watchers

 avatar

ical-to-json's Issues

Rename Events to Objects

Rename all instances of calendar "events" to Objects, as to follow the standard documentation

This also goes for Properties

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.