Skip to content

Commit

Permalink
Fix enum behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminPelletier committed Dec 1, 2023
1 parent c70b8d6 commit 20e1d2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions monitoring/monitorlib/infrastructure.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import datetime
import functools
from enum import Enum
from typing import Dict, List, Optional
import urllib.parse
from aiohttp import ClientSession, ClientResponse
Expand Down Expand Up @@ -39,6 +40,7 @@ def issue_token(self, intended_audience: str, scopes: List[str]) -> str:
def get_headers(self, url: str, scopes: List[str] = None) -> Dict[str, str]:
if scopes is None:
scopes = ALL_SCOPES
scopes = [s.value if isinstance(s, Enum) else s for s in scopes]
intended_audience = urllib.parse.urlparse(url).hostname
scope_string = " ".join(scopes)
if intended_audience not in self._tokens:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def _make_sub_req(base_url: str, notify_ops: bool, notify_constraints: bool) ->

def _read_both_scope(scd_api: str) -> str:
if scd_api == scd.API_0_3_17:
return "{} {}".format(SCOPE_SC, SCOPE_CP)
return "{} {}".format(SCOPE_SC.value, SCOPE_CP.value)
else:
raise NotImplementedError("Unsupported API version {}".format(scd_api))

Expand Down

0 comments on commit 20e1d2b

Please sign in to comment.