Giter VIP home page Giter VIP logo

ewswrapper_py's Introduction

'''
/* 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:

ewswrapper_py's People

Contributors

maiiku avatar deronnax avatar

Watchers

c0ns0le avatar

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.