Aiobungie

Latest version: v0.2.11

Safety actively analyzes 621498 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 5

0.2.11

Highlights
* Object immutability, all objects are now [*frozen*](https://www.attrs.org/en/stable/examples.html#immutability).
* 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

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

[0.2.9](https://github.com/nxtlo/aiobungie/compare/0.2.8...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

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

Breaking Changes
- Base `Client` users now will need to open the REST client before making any requests.

The old way.
py
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
py
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:
py
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:
py
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](https://github.com/nxtlo/aiobungie/pull/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

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
py
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
py
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)

Page 1 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.