Skip to main content

An interface to Microsoft Exchange Web Services (EWS). Allows the user to manipulate the outlook calendar events.

Project description

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='me@email.com',
    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='serviceAccount@email.com',
    password='SuperSecretPassword', # the service account password
    impersonation='roomAccount@email.com'
)

Oauth

import requests
from exchange_interface import EWS

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

ews = EWS(
    username='serviceAccount@email.com',
    oauthCallback=GetAccessToken, # this will be called before each HTTP request is sent
    impersonation='roomAccount@email.com'
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

exchange_interface-0.0.4.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

exchange_interface-0.0.4-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file exchange_interface-0.0.4.tar.gz.

File metadata

  • Download URL: exchange_interface-0.0.4.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for exchange_interface-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8b95c391cada2ecbd65750eebb1611065b3455eb51d86722ab61e482266a2361
MD5 125952f4e29692fc90537b8e8c658e0c
BLAKE2b-256 9b9c981a4c20c470237d4b12041e215d127096aea6f0a7d10057a70c95af6534

See more details on using hashes here.

File details

Details for the file exchange_interface-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: exchange_interface-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for exchange_interface-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dd5a56ca4d2f2c6fd851d344687884f4eefeb1465b7cab6c1b9289441473c7cd
MD5 fa3ee8679905189adf2cf46aca58e38f
BLAKE2b-256 df7d881fd3ee49c76fb711b50090ef9c336b1db9a4d21b0595c974aae9b2143f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page