Skip to main content

OpenSea NFT API Python 3 wrapper

This an API wrapper library for the OpenSea API written in Python 3.

The library provides a simplified interface to fetch a diverse set of NFT data points from OpenSea.

Supported endpoints

The wrapper covers all of the OpenSea API endpoints (as of 2021-12-02, NOT including the Orderbook and Rinkeby API):

Prerequisite

As of Dec 2, 2021 you need to have an API key to use the OpenSea API, and thus you need one to use this wrapper too. You can request a key here.

NOTE: The API key can take over 4-7 days to be delivered. It also requires you to show the project you are working on.

Installation

Install with pip:

virtualenv env && source env/bin/activate
pip install opensea-api

Usage examples

# import the OpenseaAPI object from the opensea module
from opensea import OpenseaAPI

# create an object to interact with the Opensea API (need an api key)
api = OpenseaAPI(apikey="YOUR APIKEY")

# fetch a single asset
contract_address = "0x495f947276749Ce646f68AC8c248420045cb7b5e"
token_id = "66406747123743156841746366950152533278033835913591691491127082341586364792833"
result = api.asset(asset_contract_address=contract_address, token_id=token_id)

# fetch multiple assets
result = api.assets(owner="0xce90a7949bb78892f159f428d0dc23a8e3584d75", limit=3)

# fetch a single contract
result = api.contract(asset_contract_address="0x495f947276749Ce646f68AC8c248420045cb7b5e")

# fetch a single collection
result = api.collection(collection_slug="cryptopunks")

# fetch multiple collections
result = api.collections(asset_owner="0xce90a7949bb78892f159f428d0dc23a8e3584d75", limit=3)

# fetch collection stats
result = api.collection_stats(collection_slug="cryptopunks")

# fetch multiple events
from opensea import utils as opensea_utils

period_start = opensea_utils.datetime_utc(2021, 11, 6, 14, 25)
period_end = opensea_utils.datetime_utc(2021, 11, 6, 14, 30)
result = api.events(
    occurred_after=period_start,
    occurred_before=period_end,
    limit=10,
    export_file_name="events.json",
)

# fetch multiple bundles
result = api.bundles(limit=2)

Here's a demo video showcasing the basics.

Documentation

History

0.1.3 (2021-12-03)

  • Ability to reach all endpoints from one OpenseaAPI object
  • API key support (Opensea requires it from now on)

0.1.0 (2021-11-07)

  • First release on PyPI.

Metadata

Release files for opensea-api 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for opensea-api 0.1.4
File Interpreter ABI Platform
opensea_api-0.1.4-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / opensea_api-0.1.4-py2.py3-none-any.whl

Download URL opensea_api-0.1.4-py2.py3-none-any.whl
Size 9.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f7e2ef99a32f1f519bef197805b5d1437bb8e0df6114838bac5e72027fefc6a0
BLAKE2b-256 checksum
How to use checksums
4287dc07516c946b3a89da73fc5a2a85f4ac1f0d79ec4e562bad13d9e044243c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.7.1 requests/2.26.0 setuptools/58.2.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release history Release notifications | RSS feed

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

This release

0.1.4 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page