Skip to content

Commit

Permalink
Merge pull request googleapis#100 from hellbe/master
Browse files Browse the repository at this point in the history
Support for shared inbox child folders and updated setup.py for PyPI
  • Loading branch information
Narcolapser authored Jul 20, 2018
2 parents b98e16a + 803cf22 commit 9ef839b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 34 deletions.
14 changes: 12 additions & 2 deletions O365/fluent_inbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class FluentInbox(object):
'user_folder': {
'1.0': 'https://outlook.office365.com/api/v1.0/users/{user_id}/Folders/{folder_id}/messages',
'2.0': 'https://graph.microsoft.com/v1.0/users/{user_id}/MailFolders/{folder_id}/messages',
},
'user_child_folders': {
'1.0': 'https://outlook.office365.com/api/v1.0/users/{user_id}/Folders/{folder_id}/childfolders',
'2.0': 'https://graph.microsoft.com/v1.0/users/{user_id}/MailFolders/{folder_id}/childfolders',
}
}

Expand Down Expand Up @@ -86,7 +90,10 @@ def get_folder(self, value, by='Id', parent_id=None, user_id=None):
:param user_id: user id the folder belongs to (shared mailboxes)
:returns: Single folder data
"""
if parent_id:
if parent_id and user_id:
folders_url = FluentInbox._get_url('user_child_folders').format(
folder_id=parent_id, user_id=user_id)
elif parent_id:
folders_url = FluentInbox._get_url('child_folders').format(
folder_id=parent_id)
elif user_id:
Expand Down Expand Up @@ -118,7 +125,10 @@ def list_folders(self, parent_id=None, user_id=None):
:param parent_id: Id of parent folder to list. Default to top folder
:return: List of all folder data
"""
if parent_id:
if parent_id and user_id:
folders_url = FluentInbox._get_url('user_child_folders').format(
folder_id=parent_id, user_id=user_id)
elif parent_id:
folders_url = FluentInbox._get_url('child_folders').format(
folder_id=parent_id)
elif user_id:
Expand Down
55 changes: 23 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,41 @@
#!/usr/bin/env python

from distutils.core import setup
from setuptools import setup

CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Topic :: Office/Business :: Office Suites',
'Topic :: Software Development :: Libraries'
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Topic :: Office/Business :: Office Suites',
'Topic :: Software Development :: Libraries'
]
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.

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:
from O365 import Message
authenticiation = ('[email protected]','YourPassword')
m = Message(auth=authenticiation)
m.setRecipients('[email protected]')
m.setSubject('I made an email script.')
m.setBody('Talk to the computer, cause the human does not want to hear it any more.')
m.sendMessage()
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:
https://github.com/Narcolapser/python-o365'''
with open("README.md", "r") as fh:
long_description = fh.read()

setup(name='O365',
version='0.9.15',
description='Python library for working with Microsoft Office 365',
long_description=long_desc,
long_description=long_description,
long_description_content_type="text/markdown",
author='Toben Archer',
author_email='[email protected]',
maintainer='Toben Archer',
maintainer_email='[email protected]',
url='https://github.com/Narcolapser/python-o365',
packages=['O365'],
install_requires=['requests', 'oauthlib','requests_oauthlib','future'],
install_requires=['requests', 'oauthlib', 'requests_oauthlib', 'future'],
license='Apache 2.0',
classifiers=CLASSIFIERS
)

#so I don't have to keep looking it up: python setup.py sdist upload -r pypi
"""
Quick reference:
Generate dist:
python setup.py sdist bdist_wheel
Upload to TestPyPI
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Upload to PyPI
twine upload dist/*
"""

0 comments on commit 9ef839b

Please sign in to comment.