Giter Site home page Giter Site logo

exchange_interface's Introduction

This module allows access to Microsoft Office 365 account calendars. It allows for personal, delegate, and service accounts.

Install

pip install exchange_interface

Example Script

import requests
from exchange_interface import EWS
import datetime

ews = EWS(
    username='[email protected]',
    password='SuperSecretPassword',
)
ews.Connected = lambda _, state: print('EWS', state)
ews.Disconnected = lambda _, state: print('EWS', state)
ews.NewCalendarItem = lambda _, item: print('NewCalendarItem(', item)
ews.CalendarItemChanged = lambda _, item: print('CalendarItemChanged(', item)
ews.CalendarItemDeleted = lambda _, item: print('CalendarItemDeleted(', item)

ews.UpdateCalendar()

print('Events happending now=', ews.GetNowCalItems())

print('Event(s) happening next=', ews.GetNextCalItems())

nowDT = datetime.datetime.now()
nowPlus24hrs = nowDT + datetime.timedelta(days=1)

print('Events happening in the next 24 hours=', ews.GetEventsInRange(startDT=nowDT, endDT=nowPlus24hrs))

# You can create a new event like this:
ews.CreateCalendarEvent(
    subjec='Test Subject',
    body='Test Body',
    startDT=datetime.datetime.now(),
    endDT=datetime.datetime.now() + datetime.timedelta(hours=1),
    )

Service Accounts

import requests
from exchange_interface import EWS

ews = EWS(
    username='[email protected]',
    password='SuperSecretPassword', # the service account password
    impersonation='[email protected]'
)

Oauth

import requests
from exchange_interface import EWS

def GetAccessToken():
    # do the oauth magic here
    return 'theOauthToken'

ews = EWS(
    username='[email protected]',
    oauthCallback=GetAccessToken, # this will be called before each HTTP request is sent
    impersonation='[email protected]'
)

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.