Skip to content

Instantly share code, notes, and snippets.

@alexpaden
Created February 21, 2023 16:38
Show Gist options
  • Save alexpaden/5074b3ec073158bd0715adb8822e0e39 to your computer and use it in GitHub Desktop.
Save alexpaden/5074b3ec073158bd0715adb8822e0e39 to your computer and use it in GitHub Desktop.
def get_collection_owners(
self,
collection_id: str,
cursor: NoneStr = None,
limit: PositiveInt = 25,
) -> UsersResult:
"""Get the owners of an OpenSea collection
Args:
collection_id (str): OpenSea collection ID
cursor (NoneStr, optional): cursor, defaults to None
limit (PositiveInt, optional): limit, defaults to 25
Returns:
UsersResult: model containing users
"""
response = self.warpcast._get(
"collection-owners",
params={"collectionId": collection_id, "cursor": cursor, "limit": limit},
)
return CollectionOwnersGetResponse(**response)
def follow_all_collection_owners(self, collection_id: str) -> None:
#res = self.warpcast.get_user_collections(owner_fid=self.lists.my_fid)
#res = self.warpcast.get_collection_owners(collection_id, limit=100)
owners: List = []
cursor = None
limit = 100
while True:
res = self.get_collection_owners(collection_id, limit=limit, cursor=cursor)
owners.extend(res.result.users)
if res.next is None:
break
cursor = res.next.cursor
print(len(owners))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment