Utility
These are all the utility classes and functions you can use.
Bases: Enum
Enum of all heroes available in the Marvel Rivals API.
This enumeration provides convenient access to all hero identifiers that can be used with the API. Hero names are standardized to lowercase with appropriate spacing.
Examples:
Source code in marvelrivalsapi\utility.py
Returns the full URL for an image resource.
This function prepends the base image URL to the provided image path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The relative path of the image resource. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The complete URL to the image resource. |
Examples:
>>> from marvelrivalsapi.utility import image
>>> image("/heroes/spider-man/icon.png")
'https://marvelrivalsapi.com/rivals/heroes/spider-man/icon.png'
Source code in marvelrivalsapi\utility.py
Bases: Exception
Base class for all exceptions raised by the MarvelRivalsAPI.
This exception is raised when an API request fails due to an error returned by the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
res
|
Response
|
The HTTP response that resulted in the error. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
response |
Response
|
The HTTP response object containing error details. |