linkedin / linkedin/pyexchange

Errors with Calendar Events having Attendees without an E-Mail Address

Open
#57 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
154
Forks
91
PR merge metrics
No merged PRs in 30d

Description

Hi together,
for a fancy calendar being displayed on our institute's TV screens, we have decided using an Exchange calendar (easy integration with our other calendars and stuff) & reading needed data with PyExchange for creating some kind of displaying image. I very appreciate this easy-to-use library!

However, as soon an event gets parsed that has an attendee without an email address, a TypeError is raised. Taking a closer look into the sources, you explicitly disallow mail addresses with a None value. Is there a special reason for this?
For us, this particularly does not fit our needs; there is no guarantee having 'valid' entries. I handled this by just setting an empty string in case the attendee_properties do not contain the key 'email' just before parsing the dictionary [init py, before line 504]. This works, but is kind of a quick & dirty hack.

Anyways, I just wanted to let you know about this issue.
Finally, here is the trace:

```
Traceback (most recent call last):
File "a.py", line 79, in
details=True
File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 95, in list_events
return Exchange2010CalendarEventList(service=self.service, start=start, end=end, details=details)
File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 124, in __init__
self.load_all_details()
File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 170, in load_all_details
self._parse_response_for_all_events(response_xml)
File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 139, in _parse_response_for_all_events
self._add_event(xml=soap_request.M.Items(deepcopy(item)))
File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 147, in _add_event
event = Exchange2010CalendarEvent(service=self.service, xml=xml)
File "/usr/local/lib/python2.7/dist-packages/pyexchange/base/calendar.py", line 90, in __init__
self._init_from_xml(xml)
File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 194, in _init_from_xml
properties = self._parse_response_for_get_event(xml)
File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 504, in _parse_response_for_get_event
result[u'_attendees'] = self._build_resource_dictionary([ExchangeEventResponse(**attendee) for attendee in attendee_properties])
TypeError: __new__() takes exactly 6 arguments (5 given)
```

Contributor guide

Open the contributing guide

Research direction

Start in pyexchange/exchange2010/__init__.py at _parse_response_for_get_event around line 504, then inspect how ExchangeEventResponse is constructed from attendee_properties. Reproduce parsing an attendee without an email address and verify that the event loads without the TypeError while retaining the attendee data.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.