-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E-Mail Support? #44
Comments
Hey there, I have no plans to add in support for email (the current state of things works for us), but I'd be more than happy to get pull requests on it! For difficulty, I would say it's not hard, but it's a little tricky. The library takes the approach of using raw XML instead of SOAP (since python soap libraries are all terrible), so the difficulty is really in 1) figuring out what XML to send to Exchange and what you're going to get back and 2) serializing/deserializing XML to objects and vice versa. That last part isn't too bad, actually, you can see what we do for calendar stuff - it's mostly a lot of XPath. Microsoft has pretty fantastic documentation on it's SOAP responses, so it's a matter of combing through those and figuring out what you need. Here's a test script I use to talk to Exchange and experiment: https://gist.github.com/trustrachel/b70d79ea670f048ed165 Once you know the XML request/response formats, the rest of it is pretty straightforward. Are you going to be at PyCon? I'll be there and would be happy to chat about it in person if you are. |
Hi @fizxmike, @trustrachel ; |
Hi @fizxmike, @trustrachel,
And @fizxmike, I you are about to also look at this, it would be great if we could cooperate about it? Can I e-mail you on the mail you have here on github? With regards to the estimate you asked @trustrachel about, it is difficult to say, but I'd say 10-15 hours if one knows one's way around the library. E-Mail handling seems very similar to calendar handling. I have more difficulties understanding how the unit tests work. |
Actually, I would like to start with a complete PEP 8 overhaul, as PyCharm goes so nuts with the coloring and indentation warnings that I sort of have problems seeing the forest for the trees. |
So to get things started I just tested so that is works, and it does, I put the simplest possible test in a gist here: https://gist.github.com/nicklasb/a7986731ab15a6809f0b Just copied the code into there. I run that code in the root of the repo against my server. One difference is that I don't have a real certificate on the exchange server, so I have to add verify=False in pyexchange/connection.py: I agree with the proposal to make certificate check a setting, by the way. |
BTW, I will need your response on the above questions and your feedback before I can continue. |
Hi @nicklasb, Here are my suggestions, for what they are worth:
|
Anyway, I think I have enough to stand on to begin at some level. Putting up the m¤%¤¤#f#¤=#ng exchange server* took me almost two workdays, though, so I have lost a lot time, but I hope to be able to at least implement something.
|
RE: 4, I've obviously touched upon a hot topic of hot debate... I am not opposed to updating PEP 8 understanding that we all have modern text editors that are agnostic to spaces vs. tabs, and have 4K monitors that are agnostic to line ending length... other than that, I think PEP 8 is a good idea, in general. RE: Microsoft, Don't you know that worse is better? http://www.jwz.org/doc/worse-is-better.html |
Hey @nicklasb, I think it would be fine to go through and fix code to comply with PEP8. I've actually done that several times with the files I've worked with. However, maybe just exclude the 4 space indentation and line length rules. I haven't messed with PyCharm much, I'm more of a vim guy, but can you configure it to just ignore those two PEP8 rules? Here is the style guide that @trustrachel wrote up when she made this project public: https://github.com/linkedin/pyexchange/blob/master/CONTRIBUTING.rst#style-guide |
@fizxmike : Indentation: So if they are so agnostic, why no just follow the the PEP 8 guidelines that most other projects follow anyway? Then it wouldn't matter, would it? :-) Line length, it is not just about screen size:
@got-root : I'll see what I'll do. I am a bit apprehensive about having my first commit to a project affect all its files. :-) |
To get back on topic: Get_Item for messages: Get_Item for calendar events: So, I will add both, and lay it upon the caller to include the correct ones, but raise an error if both are supplied, saving people from at least some inexplicable 500 errors. Because the other kinds, tasks and contacts, have no extra parameters, so it works for that use as well. Should be kind of future-safe. New signature: |
Funny thing, again off topic: But I don't know if I can give away copyright to someone without them formally accepting it. And all mergers here doesn't work at LinkedIn. If I would create something completely from scratch in this project, should I then put (c) 2015 Optimal BPM at the top? Asking since all IDE:s and build environments I know of only have per-project copyrights. |
The property management code in the folder and calendar seem a bit copy&pasted. |
So I am spamming on, I have started implementing this now, as I have all these questions:
So, my question is, when it is done, I will add my stuff, without doing structural changes. |
Because with regards to messages, most fields are in the root of the item, an thus doesn't even need any xpath references, but can be inferred from correctly capitalizing the properties: |
I have just realized that there are a bit too many questions that needs answering before I do this, my process will be too inefficient this way, so I will stop for now. The way it is now, I would have to do way too much copying and pasting, the code base needs to become more extensible, there need to be a discussion about that that leads to defined tasks. If the ambition of pyexchange is to implement all exchange access methods, the structure must reflect that. The branch I have worked with is this one, you can see the changes there: The most important additions are the base message class: and the changes at: In short, and with the exception of importing all the properties of the message class using a spreadsheet, which was so fun I had to write about it, I am basically copying the calendar stuff and rewriting it for messages, and that doesn't feel very good, honestly, as there are huge amounts of code being duplicated. |
Hi @nicklasb, I've been away for the last couple of weeks, so I wanted to first apologize for not getting back to you! Let me try to address at least some of the items here. The minor stuff first! PEP8 - 2 spaces and unlimited line length is LinkedIn's in-house style, so that was a deliberate choice. I personally have come to prefer it over classic PEP8, so I want to keep that. I use PyCharm, too, and you can turn that particular alert off. PEP8 is fantastic, but it's not law. :) Copyright - Not a lawyer, but as far as I understand it, yes, LinkedIn does own the copyright on the library since I work for them, but since it's released under the Apache 2 license they grant everybody the right to use, copy, modify, distribute, etc, etc, for any reason, including commercial. It's no different than my personal libraries - I own the copyright on them, but I license it under Apache as well. So yes, you would want to put the copyright notice in there. You have now come to the end of my understanding on copyright. As for the other issues you raised. The library will 100% need some refactoring if we're going to make it implement all of the Exchange protocol. I don't like 1200 line files more than anybody else. It's perfectly fine to put stuff in A question for you - is there a part of the email protocol we could implement in the current style? That would let us figure out what parts of the library could use refactoring first. |
PEP8: Meh. With that attitude, you'll never get that little "LinkedIn"-company or whatchamacallit out of the basement. :-) Copyright: Me neither. Hm. One should really know about these things. Well, I'll put LinkedIn in there when I do it, I certainly make no claims. We could, but its just uninspiring to copy&paste code all over, knowing that it all has to be rewritten soon anyway. Also, I have no customers breathing down my neck on this and don't positively need this functionality until in December or something. And if I needed to do a quick'n dirty solution I'd just use get_item and implement directly against the API. I can work directly against the XML response anyway, I don't really need to transform it into an Python object for my purposes. But my point is that I'd rather do it correctly. And it seems to me that refactoring this project would not be a very complicated task, at least at its present state. But I don't feel like turning it inside out, I am not sufficiently structurally aware. Yes, generalizing get_item could be done as we've talked about in this thread, and then at least people could get the messages easily. |
Our institution disables SMTP functionality on our e-mail accounts, forcing us to use their web client or some other native Exchange client (mobile or otherwise). We want our web apps to send out automated e-mails through our institutions exchange system as local e-mails are secure.
So, is there any plan to add E-mail/Inbox functionality to pyexchange? Also, how much effort do you estimate is required if I were to want to extend your code to do this?
The text was updated successfully, but these errors were encountered: