Skip to content

Releases: nxtlo/aiobungie

0.3.1

11 Sep 08:52
Compare
Choose a tag to compare

Added

Removed

  • Client.run, use asyncio.run instead.

Changed

  • Support aiohttp 3.10.5 compatibility

0.3.0

25 Jul 11:35
Compare
Choose a tag to compare

This release contains a lot of changes, please read this if you're a user of this library.

Added

methods

  • fetch_sanitized_membership, available on both client APIs
  • search_groups, available on both client APIs
  • RESTClient.report_player
  • RESTClient.force_drops_repair
  • RESTClient.claim_partner_offer
  • RESTClient.fetch_bungie_rewards_for_user
  • RESTClient.fetch_bungie_rewards_for_platform
  • RESTClient.fetch_bungie_rewards
  • Image.stream
  • Image.chunks
  • FireteamFinder methods, available through the RESTClient.build_fireteam_finder method.

components

  • implemented the CHARACTER LOADOUTS component along with its framework methods, You can access it via Components.character_loadouts
    after fetching a profile. or loadouts after fetching a character.
  • implemented the SOCIAL COMMENDATIONS components, you can access it via Components.commendations after fetching a profile.

object fields

  • type, profile_ban_expire and egs_name fields to BungieUser
  • code field to PartialBungieUser
  • origin field to Application
  • emblem_color field to Character
  • minutes_played_this_session field to Character
  • percent_to_next_level field to Character
  • Added the following to Profile
    • season_hashes
    • versions_owned
    • season_hash
    • guardian_rank
    • highest_guardian_rank
    • renewed_guardian_rank
    • event_card_hashes
    • user, removed name, id and type in favor of this.
  • Added available_activity_interactables to CharacterActivity

other

  • sain as a required dependency. this is used mainly to replace iterators
  • custom_client example
  • GameVersions enum.
  • An option to use a specific executor for downloading the manifest and Image.save method.
import concurrent.futures
# Use process pool executor to write the manifest data.
await rest.download_json_manifest(
  ...,
  executor=concurrent.futures.ProcessPoolExecutor()
)
  • FireteamBuilder in aiobungie.builders

Changed

name changes

  • interfaces dir is renamed to api.
  • factory renamed to framework and exported to top level, no longer an internal package
  • factory.Factory is now framework.Framework.
  • interfaces.RESTInterface renamed to api.RESTClient which matches rest.RESTClient.
  • interfaces.FactoryInterface renamed to api.Framework which matches framework.Framework.
  • trait Netrunner renamed to Send and is no longer used, currently kept for future plans.
  • trait Serializable renamed to Deserialize and its method factory renamed to framework.
  • trait ClientApp renamed to Compact.
  • Client.factory is now Client.framework.
  • factory.EmptyFactory is now framework.Empty and is now deprecated, use Framework() instead.
  • UserLike abstract class renamed to Unique.
  • deserialize_app renamed to deserialize_application.
  • deserialize_app_owner renamed to deserialize_application_member
  • ApplicationOwner is now ApplicationMember and the user fields are accessible through .user
  • Application.owner field is now Application.team which returns the entire application roaster instead of just the owner.
  • Framework.deserialize_fireteam_destiny_users renamed to deserialize_fireteam_destiny_membership
  • FireteamMember.destiny_user renamed to FireteamMember.membership
  • Image.default_or_else is now just Image.default

other changes

  • Framework doesn't require a net parameter anymore.
  • Client.run is deprecated and will be removed in the next major release.
  • RESTClient.with_debug has been moved to traits.RESTful with a default final impl.
  • internal.assets which contained Image has been moved to aiobungie.builders
  • Image now accepts None as a default path.
  • sain package is now used as the default iterator builder.
    it is a dependency free that's developed by me so it won't really have any side-effects.
  • If you're a RESTPool user, it is possible to call build_oauth2_url without acquiring a client instance
    this is a good change for performance improvements since acquiring a client instance also means opening a TCP connection,
    which is useless when you're still not making any requests.
pool = aiobungie.RESTPool("token", client_id=0000, client_secret="secret")
url = pool.build_oauth2_url()

# same as
async with pool.acquire() as client:
  url = client.build_oauth2_url()

# also the same
url = pool.acquire().build_oauth2_url()

Removed

The following methods were scheduled to be removed in this version.

  • PartialBungieUser.fetch_self()
  • ProfileItemImpl.is_transferable
  • ProfileItemImpl.collect_characters
  • ProfileItemImpl.fetch_self
  • DestinyMembership.fetch_self_profile
  • QuesStatus.fetch_quest
  • QuestStatus.fetch_step
  • Objective.fetch_self
  • ItemsComponent.any
  • ItemsComponent.all
  • Challenges.fetch_objective
  • Rewards.fetch_self
  • Activity.is_solo
  • Activity.is_flawless
  • Activity.is_solo_flawless
  • Activity.fetch_post
  • Character.transfer_item
  • Character.equip_item
  • Character.equip_items
  • Character.pull_item
  • Character.fetch_activities
  • RenderedData.fetch_my_items
  • MinimalEquipments.fetch_my_item
  • AvailableActivity.fetch_self
  • ClanMember.ban
  • ClanMember.unban
  • ClanMember.kick
  • ClanMember.fetch_clan
  • GroupMember.fetch_self_clan
  • Clan.deny_pending_members
  • Clan.approve_pending_members
  • Clan.add_optional_conversations
  • Clan.fetch_banned_members
  • Clan.fetch_pending_members
  • Clan.fetch_invited_members
  • Clan.fetch_conversations
  • Clan.fetch_available_fireteams
  • Clan.fetch_fireteams
  • Clan.fetch_members
  • Clan.edit
  • Clan.edit_options
  • ClanConversation.edit
  • CraftablesComponent.fetch_craftables
  • SearchableEntity.fetch_self_item

these methods above are still accessible via the both clients, either the RESTClient or Client,
their abstraction on the object just got removed not that actual implementation of the method.

ok but how do i reproduce those?

client = aiobungie.Client("...")

async def character_transfer_item() -> None:
    # Instead of: await character.transfer_item(...)
    # call it from the client directly.
    await client.rest.transfer_item(token, char_id, item_id)

async def character_fetch_activities() -> None:
    # Instead of: await character.fetch_activities(...)
    # call it from the client directly.
    await client.fetch_activities(cid, mid, mode, ...)

ok but why? there're multiple reasons why those got removed.

good practices; at the beginning, those methods were meant to provide a higher-level abstraction over the object itself,
so you can call them directly from the object, while it is a nice QoL thing, it can, if misused, end up with worse overall code.
this change should forward users with developing good code and practices and make them more aware of both client APIs.

conflict and unsafety; since those methods can also be accessed via an empty deserializer results, this introduces bugs for the user of this lib,

Example:

framework = aiobungie.framework.Empty()

response = requests.get(...)
user_object = framework.deserialize_user(response.json())

# this is undefined behavior, since an empty deserializer doesn't have a client associated with it.
await user_object.fetch_self()

aiobungie crates are meant to be a stand-alone representation of the fetched API results. which payloads deserializes into. so those methods won't really fit in.

  • .net field removed from all objects.
  • UserLike.icon
  • UserLike.last_seen_name
  • UserLike.is_public
  • ComponentFields enum
  • Image.url, use Image.create_url instead.
  • iterators package in favor of sain

Fixed

  • deserializing Friend object was raising KeyError due to name field.
  • vault option in method pull_item now works as intended, thanks to #418 for opening the issue.
  • ComponentType.CHARACTER_PROGRESSIONS enum field name typo fixed.

0.2.11

05 Feb 17:00
Compare
Choose a tag to compare

Highlights

  • Object immutability, all objects are now frozen.
  • All sequences are now built as tuples instead of list, This helps reducing the size of the allocated bytes
    and increases the speed by a little bit since tuples are sized and lists are dynamic, This obviously depends on how
    large the data that has been fetched. But in general tuples are faster.
  • You'll be getting deprecation warning on crates level helper methods.
  • RESTClient.enable_debug renamed to RESTClient.with_debug method.

Added

  • Iterator.by_ref method.
  • Installing option full by calling pip install aiobungie[full].

Removed

  • traits.Debug trait.
  • The alias crate for crates is removed. Use aiobungie.crates instead.
  • rest.RequestMethod enum.

Changed

  • Logging an Iterator object now doesn't consume the data.
  • set_item_lock_state is currently unstable due to Bungie returning HTML.
  • ClanMember.current_user_memberships is now nullable.
  • Optimized factory deserialization methods.
  • The enable_debugging parameter renamed to debug.
  • You won't need to pass True when calling RESTClient.enable_debug.

0.2.10

12 Dec 19:49
9d74af5
Compare
Choose a tag to compare

Fixed

  • Fixed fetch_oauth2_tokens and refresh_access_token raising BadRequest. Thanks to @MagneticZer0 for reproting #318
  • client_secret was being logged in the headers when enabling TRACE log level.

0.2.9

01 Dec 14:49
Compare
Choose a tag to compare

0.2.9 - 2023-12-1

Major Changes

  • Python 3.10 and above is now required, 3.9.0 is no longer supported.
  • Method fetch_player renamed to fetch_membership.
  • download_manifest method has been renamed to download_sqlite_manifest

Performance Improvements.

  • Optimized converting ISO8661 date strings to datetime, dateutil package has been dropped and the converting process has been implemented directly using stdlib datetime.
  • orjson and ujson are a faster replacement for the JSON lib, If were found installed, They will be used as the default JSON encode/decoder.
  • ruff is now used as the default formatter. This is rather an internal change and shouldn't affect users.

Added

  • Added more examples.
  • Lightfall loadouts methods to the RESTClient.
    • equip_loadout
    • clear_loadout
    • snapshot_loadout
    • update_loadout
  • CHARACTER_LOADOUTS components type enum field.
  • If your Python version is 3.10, A backport of datetime.fromisoformat module will be installed.
    This is required due to this specific Python version not able to parse some ISO date formats.
  • aiobungie.EmptyFactory object. See the object docs for more info.
  • Iterator.last() method which return the last item in the iterator.

Changed

  • User.destiny renamed to User.memberships, ClanMember.bungie to ClanMember.bungie_user,
  • LinkedProfile.bungie to LinkedProfile.bungie_user for naming consistency.
  • Both download manifest methods now return pathlib.Path object.
  • All arguments in the client constructors now required to be passed as a kwarg besides the token.
  • Refactor examples code.
  • Factory methods that used to return Optional[T] now returns just T.
  • Enum.__int__ and Flag.__int__ doesn't check the instance of the type anymore.
  • iterators.into_iter function renamed to iterators.iter.
  • Use new str | None union instead of Optional[str, None]
  • Improved documentations on objects.
  • Some object field names has been typo fixed.
  • Method fetch_available_fireteams typo name fixed.
  • Character.total_played_time now returns the total time in seconds instead of string.
  • Fields emblem, emblem_icon and emblem_hash are now Optional.

Removed

  • The net field has been removed from some objects.
  • The UNDEFINED object, Fields now return T or None instead.

Fixed

  • Fixed multiple buggy Factory methods.
  • Factory.deserialize_character was raising KeyError when accessing the emblem keys, Thanks to @spacez320 (#303)

0.2.8

24 Jan 11:28
Compare
Choose a tag to compare

Changed

  • You can no longer pass rest_client instance to Client object.
  • Friend object methods has been removed since they can be performed using the RESTClient, Including
    • accept -> rest.accept_friend_request
    • decline -> rest.decline_friend_request
    • remove -> rest.remove_friend
    • remove_request -> rest.remove_friend_request
  • The _info.py package is renamed to metadata.py.
  • Updated requirements versions.

Added

  • New method added to MembershipTypeError exception into_membership which converts the membership from str to MembershipType enum.

Removed

  • Parameter max_ratelimit_retries removed from client impls.

0.2.7 release.

08 Oct 20:58
24e88ee
Compare
Choose a tag to compare

Breaking Changes

  • Base Client users now will need to open the REST client before making any requests.

The old way.

import aiobungie

# Here the client will initialize the TCP connector even though
# we're still not planning on making  any request which's not performant.
client = aiobungie.Client('...')
results = await client.fetch('...')

The new way

client = aiobungie.Client('...')

# Open the REST connection and use the client normally.
async with client.rest:
    users = await client.search_users('...')
    return users[0]

# Another way of doing that manually
# This must be called within an event loop
client.rest.open()

# Do stuff with the client...

# Close.
await client.rest.close()
  • build_oauth2_url now returns builders.OAuthURL object instead of a string URL, This is intentionally changed to seperate
    the state field from the URL. A fully generated URL can still be acquired via .compile() method or .url property.

Added

  • Special method __or__ to FlatIterator which allows to union two iterators togather as x = iterator1 | iterator2
  • New method FlatIterator.async_for_each, whichs equavilant to for_each but takes an async function instead.
    Example:
async def signup(username: str) -> None:
    async with aiohttp.request('POST', '...') as r:
        # Actual logic.
        ...

async def main():
    users = aiobungie.into_iter(["user_danny", "user_jojo"])
    await users.async_for_each(lambda username: signup(username))
  • Allow to customize where to download the manifest file.
    Example:
await client.download_manifest(name='Destiny', path='G:/Files' or pathlib.Path("Path/**/**")) # -> G:/Files/Destiny.sqlite3

Added

  • Enum fields EPIC_GAMES_STORE and DEMON. #214

Changed

  • FlatIterator no longer support async iteration.
  • Removed method FlatIterator.discard in favor of FlatIterator.filter mathod.
  • FlatIterator class renamed to Iterator.
  • Enum flags now uses bitwise << for its fields instead of = numbers assign.

Removed

  • CharacterError exception. This was supposed to be removed with 0.2.6.

Fixed

  • Docs colors.

0.2.6 update.

29 Jul 03:50
Compare
Choose a tag to compare

Highlights

  • Seson 17 new activities.

  • helpers.awaits now returns Sequence instead of Collection.

  • RESTPool impl.

  • REST_DEBUG level name to TRACE

  • aiobungie.crate is renamed to crates + Added an alias for crate for backward versions.

  • RESTnterface and RESTClient is now completly async def + typesafe.

  • PlugSocketBuilder and OAuth2Response has been moved to builders.py
    and both objects are not exposed to the project namespace anymore. However aiobungie.builders.* is exposed.

  • Objects no longer type hinted with MaybeImage and now return Image instead.

  • All methods that used to take *components now take a list of component types instead.

  • All components should be passed as is without unpacking nor using the .value attribute.

  • The auth parameter is now exposed as an actual parameter and not a kwarg.

Example

await client.fetch_profile(
    ...,
    components=[aiobungie.ComponentType.ALL_PROFILES, aiobungie.ComponentType.CHARACTERS, ...],
    auth="..."
)
  • Standard FlatIterator and into_iter in internal.iterators and exported to the project's namespace.

Example usage

import aiobungie

client = aiobungie.Client()

friends = await client.fetch_friends(...)

# This can either be used with `async for` or `for`

async for friend in (
    aiobungie.into_iter(friends) # Transform the sequence into a flat iterator.
    .filter(lambda friend: friend.type is MembershipType.STEAM)  # Filter to only steam friends.
    .take(5)  # Limit the results to 5 friends
    .discard(lambda friend: friend.online_status is Presence.ONLINE)  # Drop friends that are not online.
    .reversed()  # Reverse them.
):
    print(friend.unique_name)

RESTPool + typesafe RESTClient.

08 May 15:59
Compare
Choose a tag to compare
Pre-release

0.2.6a3 2022-05-8

Added

  • New builders.py contains results of received/sent objects to the API.
  • RESTPool impl.

Changed

  • REST_DEBUG level name to TRACE
  • enable_logging parameter now accepts str | int | bool.
  • Setting the level to True now will only log minimal information.
  • PlugSocketBuilder and OAuth2Response has been moved to builders.py
    and both objects are not exposed to the project namespace anymore. However aiobungie.builders.* is exposed.
  • aiobungie.crate is renamed to crates + Added an alias for crate for backward versions.
  • RESTnterface and RESTClient is now completly async def + typesafe.

Removed

Fixed

  • Objective in metrics components was always returning None

0.2.6a2

16 Mar 22:04
0.2.6a2
50ce73b
Compare
Choose a tag to compare
0.2.6a2 Pre-release
Pre-release

Added

  • Ability to read and save any resource that returns an Image.
  • Image mime types enum in assets.
  • fetch_aggregated_activity_stats method.
  • fetch_json_manifest method.
  • fetch_manifest_version method.

Changed

  • Objects no longer type hinted with MaybeImage and now return Image instead.
  • Manifest methods that open files are non-blocking now.
  • connect_manifest is now deprecated and scheduled for removal in 0.2.6.
  • fetch_manifest_path now return all JSON object paths instead of the SQLite one.
  • download_manifest now takes a force parameter to force downloading the manifest.
  • ABC class Entity is renamed to EntityBase and BaseEntity is now Entity.
  • property index has been removed from EntityBase to allow SearchableEntity inherit from it.

Removed

  • MaybeImage type hint.

Fixed

  • FlatIterator.sort wasn't sorting right.