Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install flit
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Release Notes
Expand Down
2 changes: 0 additions & 2 deletions .isort.cfg

This file was deleted.

5 changes: 0 additions & 5 deletions .style.yapf

This file was deleted.

18 changes: 9 additions & 9 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ verify_ssl = true
name = "pypi"

[packages] # Packages required to run the application
requests = "==2.26.0"
requests = "==2.28.1"

[dev-packages] # Packages required to develop the application
coverage = "==5.0.3"
responses = "==0.10.12"
flit = "==2.2.0"
isort = "==5.7.0"
yapf = "==0.30.0"
mypy = "==0.800"
coverage = "==6.5.0"
responses = "==0.22.0"
flit = "==3.7.1"
isort = "==5.10.0"
yapf = "==0.32.0"
mypy = "==0.982"
pylint = "==2.7.4"
pytest = "==6.2.4"
pre-commit = "==2.13.0"
pytest = "==7.1.3"
pre-commit = "==2.20.0"
azure-identity = "*"
822 changes: 442 additions & 380 deletions Pipfile.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions msgraph/core/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class HTTPClientFactory:
be applied to both the connect and the read timeouts.
:keyword obj session: A custom Session instance from the python requests library
"""

def __init__(self, **kwargs):
"""Class constructor that accepts a user provided session object and kwargs
to configure the request handling behaviour of the client"""
Expand Down
1 change: 1 addition & 0 deletions msgraph/core/_graph_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

def collect_options(func):
"""Collect middleware options into a middleware control dict and pass it as a header"""

def wrapper(*args, **kwargs):

middleware_control = dict()
Expand Down
1 change: 1 addition & 0 deletions msgraph/core/middleware/abc_token_credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


class TokenCredential(ABC):

@abstractmethod
def get_token(self, *scopes, **kwargs):
pass
1 change: 1 addition & 0 deletions msgraph/core/middleware/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


class AuthorizationHandler(BaseMiddleware):

def __init__(self, credential: TokenCredential, **kwargs):
super().__init__()
self.credential = credential
Expand Down
2 changes: 2 additions & 0 deletions msgraph/core/middleware/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class MiddlewarePipeline(HTTPAdapter):
The pipeline is implemented as a linked-list, read more about
it here https://buffered.dev/middleware-python-requests/
"""

def __init__(self):
super().__init__()
self._current_middleware = None
Expand Down Expand Up @@ -56,6 +57,7 @@ class BaseMiddleware(HTTPAdapter):
If the current middleware is the last one in the pipeline, it
makes a network request
"""

def __init__(self):
super().__init__()
self.next = None
Expand Down
1 change: 1 addition & 0 deletions msgraph/core/middleware/request_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class RequestContext:
of middleware as well as a FeatureUsage  property to keep track of middleware used
in making the request.
"""

def __init__(self, middleware_control, headers):
"""Constructor for request context instances

Expand Down
1 change: 1 addition & 0 deletions msgraph/core/middleware/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class TelemetryHandler(BaseMiddleware):
"""Middleware component that attaches metadata to a Graph request in order to help
the SDK team improve the developer experience.
"""

def send(self, request, **kwargs):

if self.is_graph_url(request.url):
Expand Down
3 changes: 0 additions & 3 deletions mypy.ini

This file was deleted.

52 changes: 42 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,46 @@
[build-system]
requires = ["flit_core >=2,<4", "requests >= 2.23.0"]
requires = ["flit_core >=3.5,<4", "requests >= 2.27.0"]
build-backend = "flit_core.buildapi"

[tool.flit.metadata]
module = "msgraph"
author = "Microsoft"
author-email = "graphtooling+python@microsoft.com"
home-page = "https://github.com/microsoftgraph/msgraph-sdk-python-core"
dist-name="msgraph-core"
requires-python=">=3.5"
classifiers = [ "License :: OSI Approved :: MIT License",]
description-file = "README.md"
[project]
name = "msgraph-core"
authors = [{name = "Microsoft", email = "graphtooling+python@microsoft.com"}]
dependencies = [
"requests >= 2.27.0",
]
license = {file = "LICENSE"}
readme = "README.md"
keywords = ["msgraph", "openAPI", "Microsoft", "Graph"]
classifiers = [
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
]
dynamic = ["version", "description"]

[project.urls]
homepage = "https://github.com/microsoftgraph/msgraph-sdk-python-core#readme"
repository = "https://github.com/microsoftgraph/msgraph-sdk-python-core"
documentation = "https://github.com/microsoftgraph/msgraph-sdk-python-core/docs"

[tool.flit.module]
name = "msgraph"

[tool.mypy]
warn_unused_configs = true
files = "msgraph"
ignore_missing_imports = true

[tool.yapf]
based_on_style = "pep8"
dedent_closing_brackets = true
each_dict_entry_on_separate_line = true
column_limit = 100

[tool.isort]
profile = "hug"
1 change: 1 addition & 0 deletions tests/unit/test_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ def test_register_middleware():


class _CustomTokenCredential:

def get_token(self, scopes):
return ['{token:https://graph.microsoft.com/}']
1 change: 1 addition & 0 deletions tests/unit/test_graph_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ def test_does_not_build_graph_urls_for_full_urls():


class _CustomTokenCredential:

def get_token(self, scopes):
return ['{token:https://graph.microsoft.com/}']
5 changes: 5 additions & 0 deletions tests/unit/test_middleware_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


class MiddlewarePipelineTest(TestCase):

def test_adds_middlewares_in_order(self):
middleware_pipeline = MiddlewarePipeline()
middleware_pipeline.add_middleware(MockRequestMiddleware1())
Expand Down Expand Up @@ -54,6 +55,7 @@ def test_response_object_is_modified_in_reverse_order(self):


class MockRequestMiddleware1(BaseMiddleware):

def __init__(self):
super().__init__()

Expand All @@ -63,6 +65,7 @@ def send(self, request, **kwargs):


class MockRequestMiddleware2(BaseMiddleware):

def __init__(self):
super().__init__()

Expand All @@ -72,6 +75,7 @@ def send(self, request, **kwargs):


class MockResponseMiddleware1(BaseMiddleware):

def __init__(self):
super().__init__()

Expand All @@ -82,6 +86,7 @@ def send(self, request, **kwargs):


class MockResponseMiddleware2(BaseMiddleware):

def __init__(self):
super().__init__()

Expand Down