Heroes
Classes related to hero data in the API.
Bases: Model
Represents a hero character in Marvel Rivals.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique hero identifier. |
name |
str
|
Hero's display name. |
real_name |
str
|
The hero's real-world identity. |
imageUrl |
str
|
URL or path to the hero's image. |
role |
str
|
The hero's role (e.g., Vanguard, Support). |
attack_type |
str
|
Hero's attack type (e.g., Melee Heroes). |
team |
list[str]
|
Factions or affiliations the hero belongs to (e.g., Avengers). |
difficulty |
str
|
Difficulty rating of the hero (e.g., "4"). |
bio |
str
|
Short biography of the hero. |
lore |
str
|
Extended lore/backstory of the hero. |
transformations |
list[Transformation]
|
Different forms the hero can transform into. |
costumes |
list[Costume]
|
List of hero costumes/skins. |
abilities |
list[Ability]
|
List of the hero's abilities. |
raw_dict |
dict
|
The original JSON data used to create this instance. |
Source code in marvelrivalsapi\models.py
Bases: Model
Represents a hero ability in Marvel Rivals.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Unique ability identifier. |
icon |
str | None
|
Icon path for the ability. |
name |
str | None
|
Name of the ability. |
type |
str
|
Type of the ability (e.g., Ultimate, Passive). |
isCollab |
bool
|
Whether the ability is from a collaboration. |
description |
str | None
|
Description of what the ability does. |
transformation_id |
str
|
ID of the transformation this ability is tied to. |
additional_fields |
dict
|
Dynamic key-value object with extra metadata. Keys vary per ability and may include: Key, Casting, Cooldown, Energy Cost, Special Effect, etc. |
raw_dict |
dict
|
The original JSON data used to create this instance. |
Source code in marvelrivalsapi\models.py
Bases: Model
Represents a hero transformation in Marvel Rivals.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique identifier for the transformation. |
name |
str
|
Name of the transformation (e.g., Bruce Banner). |
icon |
str
|
Image path for the transformation. |
health |
str | None
|
Health for the transformation, if available. |
movement_speed |
str | None
|
Movement speed in meters per second (e.g., "6m/s"). |
raw_dict |
dict
|
The original JSON data used to create this instance. |
Source code in marvelrivalsapi\models.py
Bases: Model
Represents a hero costume/skin in Marvel Rivals.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique identifier for the costume. |
name |
str
|
Name of the costume. |
icon |
str
|
Icon path for the costume. |
quality |
str
|
Quality level (e.g., NO_QUALITY). |
description |
str
|
Description of the costume. |
appearance |
str
|
Visual details about the costume appearance. |
raw_dict |
dict
|
The original JSON data used to create this instance. |
Source code in marvelrivalsapi\models.py
Bases: Model
Represents statistics for a hero in Marvel Rivals.
Attributes:
| Name | Type | Description |
|---|---|---|
hero_id |
int
|
Unique identifier for the hero. |
hero_name |
str
|
Display name of the hero. |
hero_icon |
str
|
Path or URL to the hero's icon image. |
matches |
int
|
Total number of matches the hero has been played in. |
wins |
int
|
Total number of matches won with this hero. |
k |
float
|
Average kills per match. |
d |
float
|
Average deaths per match. |
a |
float
|
Average assists per match. |
play_time |
str
|
Total play time with this hero (formatted as hours, minutes, and seconds). |
total_hero_damage |
int
|
Total damage dealt to enemy heroes. |
total_hero_heal |
int
|
Total healing done by this hero. |
total_damage_taken |
int
|
Total damage taken while playing this hero. |
session_hit_rate |
float
|
Hit rate during sessions, usually a value between 0 and 1. |
solo_kill |
float
|
Average number of solo kills per match. |
raw_dict |
dict
|
The original JSON data used to create this instance. |
Source code in marvelrivalsapi\models.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
kda
property
Calculate KDA (Kills + Assists / Deaths) ratio.
Returns:
| Type | Description |
|---|---|
float
|
KDA ratio. Returns (K+A) if deaths is 0. |
win_rate
property
Calculate win rate for this hero.
Returns:
| Type | Description |
|---|---|
float
|
Win rate as a decimal between 0 and 1. |
from_dict(data)
classmethod
Create a HeroStat instance from a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Dictionary containing hero statistics data. |
required |
Returns:
| Type | Description |
|---|---|
HeroStat
|
A new HeroStat instance. |
Source code in marvelrivalsapi\models.py
Bases: Model
Represents ranking information for a player in the current season.
Attributes:
| Name | Type | Description |
|---|---|---|
rank_game_id |
int
|
ID of the ranked game mode. |
level |
int
|
Current rank level. |
rank_score |
str
|
Current rank score. |
max_level |
int
|
Highest rank level achieved during the season. |
max_rank_score |
str
|
Highest rank score achieved during the season. |
update_time |
int
|
Last update timestamp (Unix time). |
win_count |
int
|
Number of ranked wins. |
protect_score |
int
|
Score protected due to rank protection mechanics. |
diff_score |
str
|
Score change since the last update. |
raw_dict |
dict
|
The original JSON data used to create this instance. |
Source code in marvelrivalsapi\models.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | |
last_updated
property
Get the last update time as a datetime object.
Returns:
| Type | Description |
|---|---|
datetime
|
The last time the rank was updated. |
from_dict(data)
classmethod
Create a RankSeason instance from a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Dictionary containing rank season data. |
required |
Returns:
| Type | Description |
|---|---|
RankSeason
|
A new RankSeason instance. |
Source code in marvelrivalsapi\models.py
Bases: Model
Represents a leaderboard with multiple players.
Attributes:
| Name | Type | Description |
|---|---|---|
players |
list[LeaderboardPlayer]
|
List of players on the leaderboard. |
raw_dict |
dict
|
The original JSON data used to create this instance. |
Source code in marvelrivalsapi\models.py
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | |
from_dict(data)
classmethod
Create a Leaderboard instance from a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Dictionary containing leaderboard data. |
required |
Returns:
| Type | Description |
|---|---|
Leaderboard
|
A new Leaderboard instance. |
Source code in marvelrivalsapi\models.py
sort_by_kda()
Sort players by KDA ratio (descending).
Returns:
| Type | Description |
|---|---|
list[LeaderboardPlayer]
|
List of players sorted by KDA. |
Source code in marvelrivalsapi\models.py
sort_by_rank()
Sort players by rank level (descending).
Returns:
| Type | Description |
|---|---|
list[LeaderboardPlayer]
|
List of players sorted by rank level. |
Source code in marvelrivalsapi\models.py
sort_by_wins()
Sort players by number of wins (descending).
Returns:
| Type | Description |
|---|---|
list[LeaderboardPlayer]
|
List of players sorted by wins. |
Source code in marvelrivalsapi\models.py
top_players(limit=10)
Get the top players from the leaderboard.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int
|
Number of top players to return, by default 10 |
10
|
Returns:
| Type | Description |
|---|---|
list[LeaderboardPlayer]
|
List of top players, limited by the specified number. |