Skip to content

0.2.6 update.

Compare
Choose a tag to compare
@nxtlo nxtlo released this 29 Jul 03:50
· 286 commits to master since this release

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)