Skip to content

Commit

Permalink
Pin with name
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewnanas committed Sep 25, 2024
1 parent c0a5352 commit 625b42b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ipfs_stac/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,13 @@ def fetch(self) -> None:

# Pin to local kubo node
@ensure_data_fetched
def pin(self) -> str:
response = requests.post(
f"http://{self.local_gateway}:{self.api_port}/api/v0/pin/add?arg={self.cid}",
)
def pin(self, name=None) -> str:
url = f"http://{self.local_gateway}:{self.api_port}/api/v0/pin/add?arg={self.cid}" if name is None else f"http://{self.local_gateway}:{self.api_port}/api/v0/pin/add?arg={self.cid}&name={name}"

response = requests.post(url)

if response.status_code == 200:
print("Data pinned successfully")

else:
print("Error pinning data")

Expand Down

0 comments on commit 625b42b

Please sign in to comment.