forked from maiiku/EWSWrapper_py
-
Notifications
You must be signed in to change notification settings - Fork 0
EWSWrapper provides wrapper python functions for easy usage of Microsoft Exchange Web Services (EWS)
License
angrylogic/EWSWrapper_py
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
''' /* EWSWrapper_py README file * ==================================================== * @author Michal Korzeniowski <[email protected]> * @version 0.2 * @date 04-2012 * @website http://ewswrapper.lafiel.net/ * ==================================================*/ ''' EWSWrapper provides wrapper functions for easy usage of Microsoft Exchange Web Services. EWSWrapper utilzes some code written by Erik Cederstrand <[email protected]> Currently EWSWrapper provides following functionality: - Operations on Calendar Events: - add, - update, - delete, - list - synch - Operations on Tasks: - add, - update, - delete, - list - Operations of Folders: - list - synch Documentaion can be found @ http://ewswrapper.lafiel.net/ Please see test.py for example usages of EWSWrapper. Note: For suds to work with EWS you may need to patch file caching system in SUDS. Big thanks go to Sean DiZazzo <[email protected]> for providing the necessary changes: --- suds/cache.py 2011-05-31 09:57:26.000000000 -0700 *************** *** 191,197 **** try: fn = self.__fn(id) f = self.open(fn, 'w') ! f.write(bfr) f.close() return bfr except: --- 191,197 ---- try: fn = self.__fn(id) f = self.open(fn, 'w') ! f.write(str(bfr)) # Cast the bfr object to a string f.close() return bfr except: --- suds/reader.py 2011-05-31 09:57:26.000000000 -0700 *************** *** 78,83 **** --- 78,86 ---- if d is None: d = self.download(url) cache.put(id, d) + else: # add these three lines. + sax = Parser() + d = sax.parse(string=d) self.plugins.document.parsed(url=url, document=d.root()) return d *************** Another patch needed for SUDS has to do with UTF8 encoding. If soap is returning proper UTF8 suds will most likely fail, so here’s another fix that we came up with after some hours of debbuging: *** parser.py 2011-11-08 11:44:35.951341300 +0100 *************** *** 132,138 **** return handler.nodes[0] if string is not None: source = InputSource(None) ! source.setByteStream(StringIO(string.encode('utf8'))) #set the encoding if known pos = string.find('encoding="') if(pos>0): --- 132,141 ---- return handler.nodes[0] if string is not None: source = InputSource(None) ! try: ! source.setByteStream(StringIO(string.encode(‘utf8’))) ! except UnicodeDecodeError: ! source.setByteStream(StringIO(string)) #set the encoding if known pos = string.find('encoding="') if(pos>0): Here's yet another fix for suds, this time when you are getting wring DST offset. MSEx will return dates in UTC, and while SUDS will use your local timezone on date conversion it WON'T respect DST offset. Here's a fix for that pesky problem: ***\suds\sax\date.py 2011-10-04 07:31:39.000000000 +0200 *************** *** 302,313 **** --- 302,316 ---- """ Adjust for TZ offset. """ if not hasattr(self, 'offset'): return delta = self.tz.adjustment(self.offset) + #check for DST + ltime = time.localtime(int(time.mktime(self.datetime.timetuple()))) + delta += dt.timedelta(hours=ltime.tm_isdst) try: d = ( self.datetime + delta ) self.datetime = d self.date = d.date() self.time = d.time() except OverflowError:
About
EWSWrapper provides wrapper python functions for easy usage of Microsoft Exchange Web Services (EWS)
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 100.0%