Skip to content

Commit

Permalink
fix: url encode to handle slash in creator
Browse files Browse the repository at this point in the history
  • Loading branch information
andyantrim committed Oct 24, 2024
1 parent 55b8af0 commit 044a944
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions nyx_client/nyx_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from collections.abc import Sequence
from enum import Enum, unique
from typing import Any, Literal
from urllib.parse import quote_plus

import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder
Expand Down Expand Up @@ -518,12 +519,18 @@ def get_data(
]

def get_my_data_by_name(self, name: str) -> Data:
"""Retrieve a data based on its unique name.
"""Retrieve your own data based on its unique name.
This only works on data you own
Args:
name: The data unique name.
name: The data unique name (unique per organization).
Returns:
The `Data` instance identified with the provided name.
Your `Data` instance identified with the provided name.
Raises:
requests.HTTPError: If the API request fails.
"""
resp = self._nyx_get(f"{NYX_PRODUCTS_ENDPOINT}/{name}")
return Data(
Expand Down Expand Up @@ -760,4 +767,6 @@ def unsubscribe(self, data: Data):
Raises:
requests.HTTPError: If the API request fails.
"""
self._nyx_delete(f"{NYX_PURCHASES_TRANSACTIONS_ENDPOINT}/{data.creator}/{data.name}")
# Creator is expected to be double encoded
creator = quote_plus(quote_plus(data.creator))
self._nyx_delete(f"{NYX_PURCHASES_TRANSACTIONS_ENDPOINT}/{creator}/{data.name}")

0 comments on commit 044a944

Please sign in to comment.