Adapters
IPFS
Provides an interface for Requests sessions to contact IPFS urls.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host_prefixes |
list[str]
|
list of possible host url prefixes to choose from |
None
|
key |
str
|
optional key to send with request |
None
|
secret |
str
|
optional secret to send with request |
None
|
timeout |
int
|
request timeout in seconds. Defaults to 10 seconds. |
10
|
Source code in offchain/metadata/adapters/ipfs.py
gen_send(url, sess, *args, **kwargs)
async
Format and send async request to IPFS host.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
url to send request to |
required |
sess |
AsyncClient
|
async client session |
required |
Returns:
Type | Description |
---|---|
Response
|
httpx.Response: response from IPFS host. |
Source code in offchain/metadata/adapters/ipfs.py
make_request_url(request_url, gateway=None)
Parse and format incoming IPFS request url
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request_url |
str
|
incoming IPFS request url |
required |
gateway |
Optional[str]
|
gateway to use when making a request |
None
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
formatted IPFS url |
Source code in offchain/metadata/adapters/ipfs.py
send(request, *args, **kwargs)
For IPFS hashes, query pinata cloud gateway
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request |
PreparedRequest
|
incoming request |
required |
Returns:
Name | Type | Description |
---|---|---|
Response |
Response
|
response from IPFS Gateway |
Source code in offchain/metadata/adapters/ipfs.py
ARWeave
Provides an interface for Requests sessions to contact ARWeave urls.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host_prefixes |
list[str]
|
list of possible host url prefixes to choose from |
None
|
key |
str
|
optional key to send with request |
None
|
secret |
str
|
optional secret to send with request |
None
|
timeout |
int
|
request timeout in seconds. Defaults to 10 seconds. |
10
|
Source code in offchain/metadata/adapters/arweave.py
gen_send(url, sess, *args, **kwargs)
async
Format and send async request to ARWeave host.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
url to send request to |
required |
sess |
AsyncClient
|
async client |
required |
Returns:
Type | Description |
---|---|
Response
|
httpx.Response: response from ARWeave host. |
Source code in offchain/metadata/adapters/arweave.py
parse_ar_url(url)
Format and send async request to ARWeave host.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
url to send request to |
required |
sess |
AsyncClient
|
async client |
required |
Returns:
Type | Description |
---|---|
str
|
httpx.Response: response from ARWeave host. |
Source code in offchain/metadata/adapters/arweave.py
send(request, *args, **kwargs)
Format and send request to ARWeave host.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request |
PreparedRequest
|
incoming request |
required |
Returns:
Name | Type | Description |
---|---|---|
Response |
Response
|
response from ARWeave host. |
Source code in offchain/metadata/adapters/arweave.py
Data URI
Provides an interface for Requests sessions to handle data uris.
Source code in offchain/metadata/adapters/data_uri.py
gen_send(url, *args, **kwargs)
async
Handle async data uri request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
url |
required |
Returns:
Type | Description |
---|---|
Response
|
httpx.Response: encoded data uri response. |
Source code in offchain/metadata/adapters/data_uri.py
send(request, *args, **kwargs)
Handle data uri request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request |
PreparedRequest
|
incoming request |
required |
Returns:
Name | Type | Description |
---|---|---|
Response |
encoded data uri response. |