Skip to content

Commit db88814

Browse files
committed
refactor: Remove yarl dependency entirely
1 parent 36dfb4c commit db88814

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ appdirs
44
ecdsa
55
ms_cv
66
pydantic
7-
yarl
87

98
# Dev
109
pytest

tests/test_auth.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
@pytest.mark.asyncio
1111
async def test_generate_auth_url(auth_mgr):
1212
url = auth_mgr.generate_authorization_url()
13-
assert "https://login.live.com/oauth20_authorize.srf" in url
13+
assert url.startswith("https://login.live.com/oauth20_authorize.srf?")
14+
assert "client_id=abc" in url
15+
assert "response_type=code" in url
1416

1517

1618
@pytest.mark.asyncio

xbox/webapi/authentication/manager.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import uuid
99

1010
import httpx
11-
from yarl import URL
1211

1312
from xbox.webapi.authentication.models import (
1413
OAuth2TokenResponse,
@@ -46,7 +45,7 @@ def __init__(
4645

4746
def generate_authorization_url(self, state: Optional[str] = None) -> str:
4847
"""Generate Windows Live Authorization URL."""
49-
query_string = {
48+
query_params = {
5049
"client_id": self._client_id,
5150
"response_type": "code",
5251
"approval_prompt": "auto",
@@ -55,10 +54,12 @@ def generate_authorization_url(self, state: Optional[str] = None) -> str:
5554
}
5655

5756
if state:
58-
query_string["state"] = state
57+
query_params["state"] = state
5958

6059
return str(
61-
URL("https://login.live.com/oauth20_authorize.srf").with_query(query_string)
60+
httpx.URL(
61+
"https://login.live.com/oauth20_authorize.srf", params=query_params
62+
)
6263
)
6364

6465
async def request_tokens(self, authorization_code: str) -> None:

0 commit comments

Comments
 (0)