Skip to content

Commit 9ef839b

Browse files
authored
Merge pull request O365#100 from hellbe/master
Support for shared inbox child folders and updated setup.py for PyPI
2 parents b98e16a + 803cf22 commit 9ef839b

File tree

2 files changed

+35
-34
lines changed

2 files changed

+35
-34
lines changed

O365/fluent_inbox.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ class FluentInbox(object):
3131
'user_folder': {
3232
'1.0': 'https://outlook.office365.com/api/v1.0/users/{user_id}/Folders/{folder_id}/messages',
3333
'2.0': 'https://graph.microsoft.com/v1.0/users/{user_id}/MailFolders/{folder_id}/messages',
34+
},
35+
'user_child_folders': {
36+
'1.0': 'https://outlook.office365.com/api/v1.0/users/{user_id}/Folders/{folder_id}/childfolders',
37+
'2.0': 'https://graph.microsoft.com/v1.0/users/{user_id}/MailFolders/{folder_id}/childfolders',
3438
}
3539
}
3640

@@ -86,7 +90,10 @@ def get_folder(self, value, by='Id', parent_id=None, user_id=None):
8690
:param user_id: user id the folder belongs to (shared mailboxes)
8791
:returns: Single folder data
8892
"""
89-
if parent_id:
93+
if parent_id and user_id:
94+
folders_url = FluentInbox._get_url('user_child_folders').format(
95+
folder_id=parent_id, user_id=user_id)
96+
elif parent_id:
9097
folders_url = FluentInbox._get_url('child_folders').format(
9198
folder_id=parent_id)
9299
elif user_id:
@@ -118,7 +125,10 @@ def list_folders(self, parent_id=None, user_id=None):
118125
:param parent_id: Id of parent folder to list. Default to top folder
119126
:return: List of all folder data
120127
"""
121-
if parent_id:
128+
if parent_id and user_id:
129+
folders_url = FluentInbox._get_url('user_child_folders').format(
130+
folder_id=parent_id, user_id=user_id)
131+
elif parent_id:
122132
folders_url = FluentInbox._get_url('child_folders').format(
123133
folder_id=parent_id)
124134
elif user_id:

setup.py

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,41 @@
11
#!/usr/bin/env python
22

3-
from distutils.core import setup
3+
from setuptools import setup
44

55
CLASSIFIERS = [
6-
'Development Status :: 4 - Beta',
7-
'Intended Audience :: Developers',
8-
'License :: OSI Approved :: Apache Software License',
9-
'Topic :: Office/Business :: Office Suites',
10-
'Topic :: Software Development :: Libraries'
6+
'Development Status :: 4 - Beta',
7+
'Intended Audience :: Developers',
8+
'License :: OSI Approved :: Apache Software License',
9+
'Topic :: Office/Business :: Office Suites',
10+
'Topic :: Software Development :: Libraries'
1111
]
12-
long_desc = '''When I started making this library I was looking for something that would provide a simple interface to an office365 mailbox. I was creating a system that would allow people send an email to our printer without having to require they install drivers or be inside the office firewall (important for students). As I found working with the office API to be fairly easy, I quickly built up solid general use library for working with office 365.
1312

14-
The objective here is to make it easy to make utilities that are to be run against an office 365 account. for example, the code for sending an email is:
15-
16-
17-
from O365 import Message
18-
19-
authenticiation = ('YourAccount@office365.com','YourPassword')
20-
21-
m = Message(auth=authenticiation)
22-
23-
m.setRecipients('reciving@office365.com')
24-
25-
m.setSubject('I made an email script.')
26-
27-
m.setBody('Talk to the computer, cause the human does not want to hear it any more.')
28-
29-
m.sendMessage()
30-
31-
32-
That's it. making and sending emails and events is now very simple and straight forward. I've used it for emailing the printer and creating a overview of our car booking system. simple, easy, but still in development. Any suggestions or advice are quite welcome at the projects github page:
33-
https://github.com/Narcolapser/python-o365'''
13+
with open("README.md", "r") as fh:
14+
long_description = fh.read()
3415

3516
setup(name='O365',
3617
version='0.9.15',
3718
description='Python library for working with Microsoft Office 365',
38-
long_description=long_desc,
19+
long_description=long_description,
20+
long_description_content_type="text/markdown",
3921
author='Toben Archer',
4022
author_email='sandslash+O365@gmail.com',
41-
maintainer='Toben Archer',
42-
maintainer_email='sandslash+O365@gmail.com',
4323
url='https://github.com/Narcolapser/python-o365',
4424
packages=['O365'],
45-
install_requires=['requests', 'oauthlib','requests_oauthlib','future'],
25+
install_requires=['requests', 'oauthlib', 'requests_oauthlib', 'future'],
4626
license='Apache 2.0',
4727
classifiers=CLASSIFIERS
4828
)
4929

50-
#so I don't have to keep looking it up: python setup.py sdist upload -r pypi
30+
"""
31+
Quick reference:
32+
33+
Generate dist:
34+
python setup.py sdist bdist_wheel
35+
36+
Upload to TestPyPI
37+
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
38+
39+
Upload to PyPI
40+
twine upload dist/*
41+
"""

0 commit comments

Comments
 (0)