Giter VIP home page Giter VIP logo

Comments (14)

ecederstrand avatar ecederstrand commented on May 26, 2024

Hi selonov,

Configuration takes either a service_endpoint or a server keyword argument. The former is the full URL to the EWS service endpoint, i.e. https://mail.example.com/EWS/Exchange.asmx. The latter is the server hostname, i.e. https://mail.example.com.

Just use the server argument unless your EWS service endpoint is located at a non-standard URL.

from exchangelib.

sleonov avatar sleonov commented on May 26, 2024

Thank you. That helped.

I am now stuck at parsing the Email item.

ids = account.inbox.find_items(shape=IdOnly)
items = account.inbox.get_items(ids)

for item in items:
subject = item.elem_for_field('subject')
body = item.elem_for_field('body')
date = item.elem_for_field('datetime_sent')
sender = item.elem_for_field('sender')
..

..

When I tyr to parse each element (sender for example), it only appears to
have Tag, but not the value.
I am not sure what I am doing wrong. Can you assist? Thank you!

On Wed, Sep 7, 2016 at 7:37 PM, Erik Cederstrand [email protected]
wrote:

Hi selonov,

Configuration takes either a service_endpoint or a server keyword
argument. The former is the full URL to the EWS service endpoint, i.e.
https://mail.example.com/EWS/Exchange.asmx. The latter is the server
hostname, i.e. https://mail.example.com.

Just use the server argument unless your EWS service endpoint is located
at a non-standard URL.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQkUdKx3xsLHmMv6za2Dow29jyeHndm2ks5qn1jbgaJpZM4J3bUc
.

from exchangelib.

sleonov avatar sleonov commented on May 26, 2024

sender_data = ET.tostring(sender)

On Thu, Sep 8, 2016 at 1:56 PM, Sergey Leonovich [email protected]
wrote:

Thank you. That helped.

I am now stuck at parsing the Email item.

ids = account.inbox.find_items(shape=IdOnly)
items = account.inbox.get_items(ids)

for item in items:
subject = item.elem_for_field('subject')
body = item.elem_for_field('body')
date = item.elem_for_field('datetime_sent')
sender = item.elem_for_field('sender')
..

..

When I tyr to parse each element (sender for example), it only appears to
have Tag, but not the value.
I am not sure what I am doing wrong. Can you assist? Thank you!

On Wed, Sep 7, 2016 at 7:37 PM, Erik Cederstrand <[email protected]

wrote:

Hi selonov,

Configuration takes either a service_endpoint or a server keyword
argument. The former is the full URL to the EWS service endpoint, i.e.
https://mail.example.com/EWS/Exchange.asmx. The latter is the server
hostname, i.e. https://mail.example.com.

Just use the server argument unless your EWS service endpoint is located
at a non-standard URL.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQkUdKx3xsLHmMv6za2Dow29jyeHndm2ks5qn1jbgaJpZM4J3bUc
.

from exchangelib.

ecederstrand avatar ecederstrand commented on May 26, 2024

get_items() returns instances of the exchangelib.folders.Message model, not XML elements. So just do this:

ids = account.inbox.find_items(shape=IdOnly)
messages = account.inbox.get_items(ids)

for m in messages:
    print(m.subject, m.body, ...)

To fetch certain fields, e.g. datetime_sent, you need to set account.inbox.with_extra_fields=True before calling get_items().

from exchangelib.

ecederstrand avatar ecederstrand commented on May 26, 2024

I just committed a fix so account.inbox.get_items(ids) will get the extra fields by default. account.inbox.with_extra_fields is now deprecated.

from exchangelib.

sleonov avatar sleonov commented on May 26, 2024

Thank you very much. I will give it a shot.

On Friday, September 9, 2016, Erik Cederstrand [email protected]
wrote:

get_items() returns instances of the exchangelib.folders.Message model,
not XML elements. So just do this:

ids = account.inbox.find_items(shape=IdOnly)
messages = account.inbox.get_items(ids)

for m in messages:
print(m.subject, m.body, ...)

To fetch certain fields, e.g. datetime_sent, you need to set
account.inbox.with_extra_fields=True before calling get_items().


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQkUdNVobb6VJBvKt5CJsUvwPeNcAgrFks5qoTfGgaJpZM4J3bUc
.

from exchangelib.

sleonov avatar sleonov commented on May 26, 2024

Will I be able to get new version from pip3 now ?

On Friday, September 9, 2016, Erik Cederstrand [email protected]
wrote:

I just committed a fix so account.inbox.get_items(ids) will get the extra
fields by default. account.inbox.with_extra_fields is now deprecated.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQkUdHYkjaiYfzOuwQz-PWSqgpAFyMQQks5qoUeWgaJpZM4J3bUc
.

from exchangelib.

sleonov avatar sleonov commented on May 26, 2024

Also. Perhaps one suggestion. If I supply invalid Windows credentials in
configuration call - I get timeout error after very very long time. Is
there a timeout parameter? If not perhaps it should be added so I don't sit
waiting for very long. I plan to use this script it automated process so I
want to know fast if my credetials are wrong.

Thanks again.

On Friday, September 9, 2016, Erik Cederstrand [email protected]
wrote:

I just committed a fix so account.inbox.get_items(ids) will get the extra
fields by default. account.inbox.with_extra_fields is now deprecated.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQkUdHYkjaiYfzOuwQz-PWSqgpAFyMQQks5qoUeWgaJpZM4J3bUc
.

from exchangelib.

sleonov avatar sleonov commented on May 26, 2024

Trying to upgrade to newer version on F23:

[root@sergey_vm1 bin]# pip3 install exchangelib --upgrade
You are using pip version 7.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting exchangelib
Using cached exchangelib-1.6.2.tar.gz
Requirement already up-to-date: requests>=2.7 in
/usr/lib/python3.4/site-packages (from exchangelib)
Requirement already up-to-date: requests-ntlm>=0.2.0 in
/usr/lib/python3.4/site-packages (from exchangelib)
Requirement already up-to-date: dnspython3>=1.12.0 in
/usr/lib/python3.4/site-packages (from exchangelib)
Requirement already up-to-date: pytz in /usr/lib/python3.4/site-packages
(from exchangelib)
Collecting lxml (from exchangelib)
Using cached lxml-3.6.4.tar.gz
Requirement already up-to-date: python-ntlm3 in
/usr/lib/python3.4/site-packages (from requests-ntlm>=0.2.0->exchangelib)
Collecting six (from python-ntlm3->requests-ntlm>=0.2.0->exchangelib)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: lxml, exchangelib, six
Found existing installation: lxml 3.4.4
Uninstalling lxml-3.4.4:
Successfully uninstalled lxml-3.4.4
Running setup.py install for lxml
Complete output from command /usr/bin/python3 -c "import setuptools,
tokenize;file='/tmp/pip-build-1ltrlsab/lxml/setup.py';exec(compile(getattr(tokenize,
'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))"
install --record /tmp/pip-894lisxe-record/install-record.txt
--single-version-externally-managed --compile:
Building lxml version 3.6.4.
Building without Cython.
ERROR: b'/bin/sh: xslt-config: command not found\n'
** make sure the development packages of libxml2 and libxslt are
installed **

Using build configuration of libxslt
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/lxml
copying src/lxml/doctestcompare.py -> build/lib.linux-x86_64-3.4/lxml
copying src/lxml/__init__.py -> build/lib.linux-x86_64-3.4/lxml
copying src/lxml/_elementpath.py -> build/lib.linux-x86_64-3.4/lxml
copying src/lxml/sax.py -> build/lib.linux-x86_64-3.4/lxml
copying src/lxml/ElementInclude.py -> build/lib.linux-x86_64-3.4/lxml
copying src/lxml/usedoctest.py -> build/lib.linux-x86_64-3.4/lxml
copying src/lxml/pyclasslookup.py -> build/lib.linux-x86_64-3.4/lxml
copying src/lxml/cssselect.py -> build/lib.linux-x86_64-3.4/lxml
copying src/lxml/builder.py -> build/lib.linux-x86_64-3.4/lxml
creating build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/__init__.py ->

build/lib.linux-x86_64-3.4/lxml/includes
creating build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/diff.py -> build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/defs.py -> build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/init.py ->
build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/ElementSoup.py ->
build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/soupparser.py ->
build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/_setmixin.py ->
build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/usedoctest.py ->
build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/formfill.py ->
build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/clean.py -> build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/_diffcommand.py ->
build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/html5parser.py ->
build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/builder.py -> build/lib.linux-x86_64-3.4/lxml/html
copying src/lxml/html/_html5builder.py ->
build/lib.linux-x86_64-3.4/lxml/html
creating build/lib.linux-x86_64-3.4/lxml/isoschematron
copying src/lxml/isoschematron/init.py ->
build/lib.linux-x86_64-3.4/lxml/isoschematron
copying src/lxml/lxml.etree.h -> build/lib.linux-x86_64-3.4/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.linux-x86_64-3.4/lxml
copying src/lxml/includes/xinclude.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/uri.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/xmlschema.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/htmlparser.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/xslt.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/tree.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/xmlparser.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/xpath.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/schematron.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/config.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/dtdvalid.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/c14n.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/etreepublic.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/xmlerror.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/relaxng.pxd ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/etree_defs.h ->
build/lib.linux-x86_64-3.4/lxml/includes
copying src/lxml/includes/lxml-version.h ->
build/lib.linux-x86_64-3.4/lxml/includes
creating build/lib.linux-x86_64-3.4/lxml/isoschematron/resources
creating build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng ->
build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/rng
creating build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl ->
build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl ->
build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl
creating
build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying
src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl
->
build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying
src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl
->
build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying
src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl
->
build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying
src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl
->
build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying
src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl
->
build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying
src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt ->
build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/src
creating build/temp.linux-x86_64-3.4/src/lxml
gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1
-DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64
-mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Isrc/lxml/includes
-I/usr/include/python3.4m -c src/lxml/lxml.etree.c -o
build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:83:20: fatal error: Python.h: No such file or
directory
compilation terminated.
Compile failed: command 'gcc' failed with exit status 1
creating tmp
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInit1gv1hfr4.c -o
tmp/xmlXPathInit1gv1hfr4.o
/tmp/xmlXPathInit1gv1hfr4.c:2:1: warning: return type defaults to ‘int’
[-Wimplicit-int]
main (int argc, char **argv) {
^
cc tmp/xmlXPathInit1gv1hfr4.o -lxml2 -o a.out
error: command 'gcc' failed with exit status 1

----------------------------------------

Rolling back uninstall of lxml
Command "/usr/bin/python3 -c "import setuptools,
tokenize;file='/tmp/pip-build-1ltrlsab/lxml/setup.py';exec(compile(getattr(tokenize,
'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))"
install --record /tmp/pip-894lisxe-record/install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in
/tmp/pip-build-1ltrlsab/lxml
[root@sergey_vm1 bin]#

On Fri, Sep 9, 2016 at 8:07 AM, Sergey Leonovich [email protected]
wrote:

Will I be able to get new version from pip3 now ?

On Friday, September 9, 2016, Erik Cederstrand [email protected]
wrote:

I just committed a fix so account.inbox.get_items(ids) will get the
extra fields by default. account.inbox.with_extra_fields is now
deprecated.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQkUdHYkjaiYfzOuwQz-PWSqgpAFyMQQks5qoUeWgaJpZM4J3bUc
.

from exchangelib.

ecederstrand avatar ecederstrand commented on May 26, 2024

Yes, version 1.6.2 is available on PyPI now.

The timeout is intentional (see #16). In short, there's no way to distinguish between an account that has been rate-limited, and and invalid credentials. But since this is popping up again, I think there should be a solution for this. Maybe something like Credentials(..., fail_fast=True)?

from exchangelib.

ecederstrand avatar ecederstrand commented on May 26, 2024

Re: the build error: that's pip install lxml failing. You'll have to work out how to fix that on Fedora or ultimately with the lxml folks. Usually it's caused by some XML devel package missing on your system.

from exchangelib.

sleonov avatar sleonov commented on May 26, 2024

Erik. I appreciate all your help. I got it to work as I needed. I ended
implementing external timeout handler so I will terminate my program that
attempts to access exchange account if no response is received in 60
seconds. I do think having that parameter you are mentioning is good idea.
User most likely will not want to wait for 20 minutes waiting on timeout
error. Especially in cases like mine when I need response fast. I use this
in automated flow to search mails for process exceptions.

Have a good one.

On Friday, September 9, 2016, Erik Cederstrand [email protected]
wrote:

Yes, version 1.6.2 is available on PyPI now.

The timeout is intentional (see #16
#16). In short,
there's no way to distinguish between an account that has been
rate-limited, and and invalid credentials. But since this is popping up
again, I think there should be a solution for this. Maybe something like Credentials(...,
fail_fast=True)?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQkUdPmR0f9k63hCmZKqtR-5HtlHpNngks5qoWjJgaJpZM4J3bUc
.

from exchangelib.

ecederstrand avatar ecederstrand commented on May 26, 2024

It's on the TODO now to add such a feature. Thanks for your suggestions!

from exchangelib.

sleonov avatar sleonov commented on May 26, 2024

Thanks

from exchangelib.

Related Issues (20)

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.