Recent Releases of https://github.com/nxtlo/aiobungie
https://github.com/nxtlo/aiobungie - 0.4.0
Added
- Python 3.13 Support. i know, it has been months since this released.
framework.Globalis a pre initialized instance alternative toaiobungie.Empty.- You can customize the behavior of certain HTTP parameters via
aiobungie.builders.Settingsobject, This can be used in any client implementation, Example:
```py import aiobungie from aiobungie.builders import Settings
By default, it initialize pre-configured.
You can checkout the documentations for more details
on what you can configure.
default = Settings() client = aiobungie.RESTClient("token", settings=default) ```
- A
settingsproperty on both client implementations. owned_clientparameter toRESTClient, This allows you to use your ownaiohttp.ClientSessioninstance, Example.
```py import aiobungie import aiohttp
my_session = aiohttp.ClientSession()
What owned_client=False means here is we're using our own TCP session.
client = aiobungie.RESTClient("token", ownedclient=False, clientsession=my_session)
async with client: ... ```
This is useful if you're using one session for the entire lifetime of the program which's also being used in different parts of the program,
Removed
ujsonis no longer supported. See WhyEmptyframework, This was supposed to be removed in0.3.1.
Changed
- You need to open and close the HTTP connection by yourself when using
RESTPool, Example:
```py import aiobungie
pool = aiobungie.RESTPool("token")
async def start(): # Starting point of the program await pool.start()
async def runtime(): # We know that the pool connection is open # at this point of the program. async with pool.acquire() as client: ...
async def closing(): # Exit point of the program await pool.stop() ```
- The method
search_entntiesis currently marked asunstableuntil a further fix, This is a Bungie problem. - Methods such as
RESTClient._handle_ratelimitandRESTClient.open/closehas been unmarked as@finalmethods, which allows you to write your own logic.
Fixed
- The
TRACEdebugging level no longer outputs sensitive data.
- Python
Published by nxtlo over 1 year ago
https://github.com/nxtlo/aiobungie - 0.3.1
Added
Removed
Client.run, useasyncio.runinstead.
Changed
- Support
aiohttp3.10.5 compatibility
- Python
Published by nxtlo over 1 year ago
https://github.com/nxtlo/aiobungie - 0.3.0
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 APIssearch_groups, available on both client APIsRESTClient.report_playerRESTClient.force_drops_repairRESTClient.claim_partner_offerRESTClient.fetch_bungie_rewards_for_userRESTClient.fetch_bungie_rewards_for_platformRESTClient.fetch_bungie_rewardsImage.streamImage.chunksFireteamFindermethods, available through theRESTClient.build_fireteam_findermethod.
components
- implemented the
CHARACTER LOADOUTScomponent along with its framework methods, You can access it viaComponents.character_loadoutsafter fetching a profile. orloadoutsafter fetching a character. - implemented the
SOCIAL COMMENDATIONScomponents, you can access it viaComponents.commendationsafter fetching a profile.
object fields
type,profile_ban_expireandegs_namefields toBungieUsercodefield toPartialBungieUseroriginfield toApplicationemblem_colorfield toCharacterminutes_played_this_sessionfield toCharacterpercent_to_next_levelfield toCharacter- Added the following to
Profileseason_hashesversions_ownedseason_hashguardian_rankhighest_guardian_rankrenewed_guardian_rankevent_card_hashesuser, removedname,idandtypein favor of this.
- Added
available_activity_interactablestoCharacterActivity
other
sainas a required dependency. this is used mainly to replaceiteratorscustom_clientexampleGameVersionsenum.- An option to use a specific executor for downloading the manifest and
Image.savemethod.
```py import concurrent.futures
Use process pool executor to write the manifest data.
await rest.downloadjsonmanifest( ..., executor=concurrent.futures.ProcessPoolExecutor() ) ```
FireteamBuilderinaiobungie.builders
Changed
name changes
interfacesdir is renamed toapi.factoryrenamed toframeworkand exported to top level, no longer aninternalpackagefactory.Factoryis nowframework.Framework.interfaces.RESTInterfacerenamed toapi.RESTClientwhich matchesrest.RESTClient.interfaces.FactoryInterfacerenamed toapi.Frameworkwhich matchesframework.Framework.- trait
Netrunnerrenamed toSendand is no longer used, currently kept for future plans. - trait
Serializablerenamed toDeserializeand its methodfactoryrenamed toframework. - trait
ClientApprenamed toCompact. Client.factoryis nowClient.framework.factory.EmptyFactoryis nowframework.Emptyand is now deprecated, useFramework()instead.UserLikeabstract class renamed toUnique.deserialize_apprenamed todeserialize_application.deserialize_app_ownerrenamed todeserialize_application_memberApplicationOwneris nowApplicationMemberand the user fields are accessible through.userApplication.ownerfield is nowApplication.teamwhich returns the entire application roaster instead of just the owner.Framework.deserialize_fireteam_destiny_usersrenamed todeserialize_fireteam_destiny_membershipFireteamMember.destiny_userrenamed toFireteamMember.membershipImage.default_or_elseis now justImage.default
other changes
Frameworkdoesn't require anetparameter anymore.Client.runis deprecated and will be removed in the next major release.RESTClient.with_debughas been moved totraits.RESTfulwith a default final impl.internal.assetswhich containedImagehas been moved toaiobungie.buildersImagenow acceptsNoneas a default path.sainpackage 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
RESTPooluser, it is possible to callbuild_oauth2_urlwithout 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.
```py pool = aiobungie.RESTPool("token", clientid=0000, clientsecret="secret") url = pool.buildoauth2url()
same as
async with pool.acquire() as client: url = client.buildoauth2url()
also the same
url = pool.acquire().buildoauth2url() ```
Removed
The following methods were scheduled to be removed in this version.
PartialBungieUser.fetch_self()ProfileItemImpl.is_transferableProfileItemImpl.collect_charactersProfileItemImpl.fetch_selfDestinyMembership.fetch_self_profileQuesStatus.fetch_questQuestStatus.fetch_stepObjective.fetch_selfItemsComponent.anyItemsComponent.allChallenges.fetch_objectiveRewards.fetch_selfActivity.is_soloActivity.is_flawlessActivity.is_solo_flawlessActivity.fetch_postCharacter.transfer_itemCharacter.equip_itemCharacter.equip_itemsCharacter.pull_itemCharacter.fetch_activitiesRenderedData.fetch_my_itemsMinimalEquipments.fetch_my_itemAvailableActivity.fetch_selfClanMember.banClanMember.unbanClanMember.kickClanMember.fetch_clanGroupMember.fetch_self_clanClan.deny_pending_membersClan.approve_pending_membersClan.add_optional_conversationsClan.fetch_banned_membersClan.fetch_pending_membersClan.fetch_invited_membersClan.fetch_conversationsClan.fetch_available_fireteamsClan.fetch_fireteamsClan.fetch_membersClan.editClan.edit_optionsClanConversation.editCraftablesComponent.fetch_craftablesSearchableEntity.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?
```py client = aiobungie.Client("...")
async def charactertransferitem() -> None: # Instead of: await character.transferitem(...) # call it from the client directly. await client.rest.transferitem(token, charid, itemid)
async def characterfetchactivities() -> None: # Instead of: await character.fetchactivities(...) # call it from the client directly. await client.fetchactivities(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:
```py framework = aiobungie.framework.Empty()
response = requests.get(...) userobject = framework.deserializeuser(response.json())
this is undefined behavior, since an empty deserializer doesn't have a client associated with it.
await userobject.fetchself() ```
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.
.netfield removed from all objects.UserLike.iconUserLike.last_seen_nameUserLike.is_publicComponentFieldsenumImage.url, useImage.create_urlinstead.iteratorspackage in favor ofsain
Fixed
- deserializing
Friendobject was raisingKeyErrordue tonamefield. vaultoption in methodpull_itemnow works as intended, thanks to #418 for opening the issue.ComponentType.CHARACTER_PROGRESSIONSenum field name typo fixed.
- Python
Published by nxtlo almost 2 years ago
https://github.com/nxtlo/aiobungie - 0.2.11
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
crateslevel helper methods. RESTClient.enable_debugrenamed toRESTClient.with_debugmethod.
Added
Iterator.by_refmethod.- Installing option
fullby callingpip install aiobungie[full].
Removed
traits.Debugtrait.- The alias
crateforcratesis removed. Useaiobungie.cratesinstead. rest.RequestMethodenum.
Changed
- Logging an
Iteratorobject now doesn't consume the data. set_item_lock_stateis currently unstable due to Bungie returning HTML.ClanMember.current_user_membershipsis now nullable.- Optimized factory deserialization methods.
- The
enable_debuggingparameter renamed todebug. - You won't need to pass
Truewhen callingRESTClient.enable_debug.
- Python
Published by nxtlo over 2 years ago
https://github.com/nxtlo/aiobungie - 0.2.10 - Bug fixes
Fixed
- Fixed
fetch_oauth2_tokensandrefresh_access_tokenraisingBadRequest. Thanks to @MagneticZer0 for reproting #318 client_secretwas being logged in the headers when enablingTRACElog level.
- Python
Published by nxtlo over 2 years ago
https://github.com/nxtlo/aiobungie - 0.2.9
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_playerrenamed tofetch_membership. download_manifestmethod has been renamed todownload_sqlite_manifest
Performance Improvements.
- Optimized converting
ISO8661date strings to datetime,dateutilpackage has been dropped and the converting process has been implemented directly using stdlib datetime. orjsonandujsonare a faster replacement for the JSON lib, If were found installed, They will be used as the default JSON encode/decoder.ruffis 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_loadoutclear_loadoutsnapshot_loadoutupdate_loadout
CHARACTER_LOADOUTScomponents type enum field.- If your Python version is
3.10, A backport ofdatetime.fromisoformatmodule will be installed. This is required due to this specific Python version not able to parse some ISO date formats. aiobungie.EmptyFactoryobject. See the object docs for more info.Iterator.last()method which return the last item in the iterator.
Changed
User.destinyrenamed toUser.memberships,ClanMember.bungietoClanMember.bungie_user,LinkedProfile.bungietoLinkedProfile.bungie_userfor naming consistency.- Both download manifest methods now return
pathlib.Pathobject. - All arguments in the client constructors now required to be passed as a kwarg besides the token.
- Refactor examples code.
Factorymethods that used to returnOptional[T]now returns justT.Enum.__int__andFlag.__int__doesn't check the instance of the type anymore.iterators.into_iterfunction renamed toiterators.iter.- Use new
str | Noneunion instead ofOptional[str, None] - Improved documentations on objects.
- Some object field names has been typo fixed.
- Method
fetch_available_fireteamstypo name fixed. Character.total_played_timenow returns the total time in seconds instead of string.- Fields
emblem,emblem_iconandemblem_hashare now Optional.
Removed
- The
netfield has been removed from some objects. - The
UNDEFINEDobject, Fields now returnT or Noneinstead.
Fixed
- Fixed multiple buggy
Factorymethods. Factory.deserialize_characterwas raisingKeyErrorwhen accessing the emblem keys, Thanks to @spacez320 (#303)
- Python
Published by nxtlo over 2 years ago
https://github.com/nxtlo/aiobungie - 0.2.8
Changed
- You can no longer pass
rest_clientinstance toClientobject. Friendobject methods has been removed since they can be performed using theRESTClient, Includingaccept->rest.accept_friend_requestdecline->rest.decline_friend_requestremove->rest.remove_friendremove_request->rest.remove_friend_request
- The
_info.pypackage is renamed tometadata.py. - Updated requirements versions.
Added
- New method added to
MembershipTypeErrorexceptioninto_membershipwhich converts the membership from str toMembershipTypeenum.
Removed
- Parameter
max_ratelimit_retriesremoved from client impls.
- Python
Published by nxtlo over 3 years ago
https://github.com/nxtlo/aiobungie - 0.2.7 release.
Breaking Changes
- Base
Clientusers 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_urlnow returnsbuilders.OAuthURLobject 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.urlproperty.
Added
- Special method
__or__toFlatIteratorwhich allows to union two iterators togather asx = iterator1 | iterator2 - New method
FlatIterator.async_for_each, whichs equavilant tofor_eachbut 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.intoiter(["userdanny", "userjojo"]) await users.asyncfor_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_STOREandDEMON. #214
Changed
FlatIteratorno longer support async iteration.- Removed method
FlatIterator.discardin favor ofFlatIterator.filtermathod. FlatIteratorclass renamed toIterator.- Enum flags now uses bitwise
<<for its fields instead of=numbers assign.
Removed
CharacterErrorexception. This was supposed to be removed with0.2.6.
Fixed
- Docs colors.
- Python
Published by nxtlo over 3 years ago
https://github.com/nxtlo/aiobungie - 0.2.6 update.
Highlights
- Seson 17 new activities.
helpers.awaitsnow returnsSequenceinstead ofCollection.RESTPoolimpl.REST_DEBUGlevel name toTRACEaiobungie.crateis renamed tocrates+ Added an alias forcratefor backward versions.RESTnterfaceandRESTClientis now completlyasync def+ typesafe.PlugSocketBuilderandOAuth2Responsehas been moved tobuilders.pyand both objects are not exposed to the project namespace anymore. Howeveraiobungie.builders.*is exposed.- Objects no longer type hinted with
MaybeImageand now returnImageinstead. - All methods that used to take
*componentsnow take a list of component types instead. All components should be passed as is without unpacking nor using the
.valueattribute.The
authparameter 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
FlatIteratorandinto_iterininternal.iteratorsand 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.intoiter(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.onlinestatus is Presence.ONLINE) # Drop friends that are not online. .reversed() # Reverse them. ): print(friend.unique_name) ```
- Python
Published by nxtlo almost 4 years ago
https://github.com/nxtlo/aiobungie - RESTPool + typesafe RESTClient.
0.2.6a3 2022-05-8
Added
- New
builders.pycontains results of received/sent objects to the API. RESTPoolimpl.
Changed
REST_DEBUGlevel name toTRACEenable_loggingparameter now acceptsstr | int | bool.- Setting the level to
Truenow will only log minimal information. PlugSocketBuilderandOAuth2Responsehas been moved tobuilders.pyand both objects are not exposed to the project namespace anymore. Howeveraiobungie.builders.*is exposed.aiobungie.crateis renamed tocrates+ Added an alias forcratefor backward versions.RESTnterfaceandRESTClientis now completlyasync def+ typesafe.
Removed
Fixed
- Objective in metrics components was always returning
None
- Python
Published by nxtlo about 4 years ago
https://github.com/nxtlo/aiobungie - 0.2.6a2
Added
- Ability to read and save any resource that returns an
Image. - Image mime types enum in assets.
- fetchaggregatedactivity_stats method.
- fetchjsonmanifest method.
- fetchmanifestversion method.
Changed
- Objects no longer type hinted with
MaybeImageand now returnImageinstead. - Manifest methods that open files are non-blocking now.
- connect_manifest is now deprecated and scheduled for removal in 0.2.6.
- fetchmanifestpath now return all JSON object paths instead of the SQLite one.
- download_manifest now takes a
forceparameter to force downloading the manifest. - ABC class
Entityis renamed toEntityBaseandBaseEntityis nowEntity. - property
indexhas been removed fromEntityBaseto allowSearchableEntityinherit from it.
Removed
- MaybeImage type hint.
Fixed
- FlatIterator.sort wasn't sorting right.
- Python
Published by nxtlo about 4 years ago
https://github.com/nxtlo/aiobungie - 0.2.6a1
Major API changes
- All methods that used to take
*componentsnow take a list of component types instead. All components should be passed as is without unpacking nor using the
.valueattribute.The
authparameter 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="..."
)
Added
- Included all activities in
FireteamActivity. - Standard
FlatIteratorandinto_iterininternal.iteratorsand 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.intoiter(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.onlinestatus is Presence.ONLINE) # Drop friends that are not online. .reversed() # Reverse them. ): print(friend.unique_name) ```
Changed
- Parameter
memberidinfetch_profileis nowmembership_id. - Methods that now return a
FlatIteratorinstead of a standard sequence.- fetch_activities
- search_users
- fetchclanadmins
- fetchclanmembers
- search_entities
Fixed
KeyErrorwas being thrown when deserializingfireteam_activities.
Removed
- Method
helpers.collect.
- Python
Published by nxtlo about 4 years ago
https://github.com/nxtlo/aiobungie - TWQ API Update.
Added
RESTClientnow takes an extra parameterenable_debugging, If set toTruethen it will debug responses and log them.RESTClient.enable_debuggingmethod which does the same thing as above.- A better looking headers logging.
- A unique trace logging level
rest.REST_DEBUGwhich will be used as the main logging level for REST debugging. destination_hashandactivity_hashfields toObjective.Flagenumeration.
Changed
- Implemented The Witch Queen API update changes
OFFSNSIVEGame field to enumGameMode.CRAFTABLESenum field toComponentType.- New
CraftablesComponentwhich's returned when fetching a profile with the craftables component, This is accessed byComponent.character_craftables. - Added
entity.ObjectiveUIStyleenum. ui_labelandui_stylefields toObjectiveEntity.LEVEL_AND_REWARDfield toValueUIStyleenum.CraftableItemandCraftableSocketandCraftableSocketPlugobjects.
InventoryEntity.tier_typenow returnsTierTypeinstead ofint.TierTypeenum.helpers.unimplementedmethods which marks methods and classes as unimplemented.- Improve documentation for
traits.py. traits.ClientBasename changed toClientApp.- Methods that used to raise
NotImplementedErrorno only warns. - Improve
helpers.deprecatedmethod. CraftablesComponent.craftablesnow return an optionalCraftableItemif it returns null.MetricsComponent.metrics's objective now returnNoneit returns null.Objective.progressis not optional.
Removed
IntEnumsince now its independently used with builtinint.
Fixed
- enum field
GreenPipswasn't incluede inValueUIStylewhich was raisingValueError#123 - Fixes an error where
error.raise_errorwasn't being called when getting a non JSON response AKAtext/**. See #143
- Python
Published by nxtlo over 4 years ago
https://github.com/nxtlo/aiobungie - 0.2.5 Stable.
All change logs can be found here https://github.com/nxtlo/aiobungie/blob/master/CHANGELOG.md#025-2022-02-02 All changes between 0.2.4 and 0.2.5 can be found here https://github.com/nxtlo/aiobungie/compare/ff4c9ec311f0ada4b7e0e144a7b8ced2ce188a87...0.2.5
- Python
Published by nxtlo over 4 years ago
https://github.com/nxtlo/aiobungie - 0.2.5b14 release.
Added
fetch_unique_weapon_historymethod.- Assists fields to
activity.ExtendedWeaponValues joine_datefield toclans.ClanAdmin- Logging time takes between each request.
- Implmented
transitoryprofile component along with its objects infireteams.py. - You can now store data using
client.metadataproperty from either rest or base client which can be used globally. - Added a profile_link property to
BungieUserwhich returns their profile link. - Implemented
components.ItemComponent. - new
items.pymodule includes all item related objects. enums.ItemSubTypefor subtype inventory items.ClanMember.member_typefield.ClanMember.is_adminandis_founderfields.Clan.progressionand some extra other fields toclans.Clan.fetch_clan_weekly_rewardsmethod.fetch_clanandfetch_clan_from_idnow can takeaccess_tokenparameter for authorized user requests.
Removed
Friend.is_pendingmethod since this can be checked usingFriend.relationship.Friend.pendingmethod since this can be checked usingClient.fetch_friend_requests.Friend.addmethod since this can be used viaRESTClient.send_friend_requesthelpers.AsyncIteratorhas been removed.clans.ClanOwnerin-favor ofclans.ClanMember.fetch_member, usefetch_members(name="...")instead.
Changed
- Significantly optimized factory's checkings and deserializing.
Client.fetch_groups_for_membernow returns a sequence instead of a signle object. This also referencesfetch_potentional_groups_forr_member.- Only non-abcs and non-enums classes are exported to
__all__incrate.__init__.py access_tokenparameter is now always positional on all methods.- enum
Itemname changed toItemType. - enum
DamageTypenow holds the actual enum values instead of the hashes. - All crate fields are now relaxed. Which have the field name and type only.
- All objects that inherits from
user.UserLike.object.__str__()andstr(object)will now return the full unique name for that object. LinkedProfileno longer supportsasync for.InventoryEntity.sub_typenow returnsenums.ItemSubTypeinstead ofenums.ItemType.- Some parameters are now positional.
Client.fetch_clan_membersnow acceptsnameparameter.Client.fetch_clan_adminsnow returns a sequence ofClanMemberinstead ofClanAdmin.ClanMember.bungieis now an optional field.Clan.fetch_my_fireteamsmethod renamed tofetch_fireteams.ClanMembernow inherits fromuser.DesinyUserfor no field duplications.- Name Changes for consistensy
fetch_usermethod renamed tofetch_bungie_user.fetch_hard_linkedmethod renamed tofetch_hardlinked_credentials.fetch_appmethod renamed tofetch_application.fetch_own_bungie_userrenamed tofetch_current_user_memberships.
- More methods has been added to
RESTClient.
Fixed
Character.last_playedwasn't returning a datetime object.is_online,last_online,joined_atandgroup_idfields now correctly returned for `ClanMember
- Python
Published by nxtlo over 4 years ago
https://github.com/nxtlo/aiobungie - 0.2.5b13
Added
BadRequestexception.Character.transfer_itemandCharacter.pull_itemnow takes missingvaultoption.Character.fetch_activitiesmethod.- Finished implementing post activities methods.
is_flawless,is_soloandis_solo_flawlessuseful properties to for bothActivityandPostActivity.- Post activity extended values and player weapons values.
rest._handle_errormethod moved toerror.pyand renamed toraise_errorrest.OAuth2Responseclass returned for OAuth2 responses.RESTClient.client_idproperty.RESTClient.collect_componentsis now protected for the class.RESTClient.build_oauth2_urlmethod to build an OAuth2 URL.RESTClient.fetch_oauth2_tokensandRESTClient.refresh_access_tokennew methods.- Missing
entity.InventoryEntityfields were added. fetch_user_credentialsmethod.insert_socket_plugandinsert_socket_plug_freemethods.rest.PlugSocketBuilderto build socket plugs.set_item_lock_stateandset_quest_lock_statemethods.search_entitiesmethod.- OAuth2 example.
- Manifest example.
download_manifest,connect_manifestREST methods.
Changed
- Python 3.8 is now dropped, Python 3.9 and above are supported.
collections.abcis now used for all type hints excludingtyping.Union[]andtyping.Opional[].typedefs.JsonObjectandJsonArrayuses uppercaseJSON.- Exceptions now has fields and improved.
fetch_activityfunction name changed tofetch_activitiesfetch_activitiesnow returns a sequence(collections.Sequence[Activity]) of activities instead of a singular activity object.ActivityVaules.teamreturnstyping.Optional[int]now instead ofint.- Exported
aiobungie.urltoaiobungie.__init__.py ClientandRESTClientnow take 2 extra optional parameters,client_secretandclient_idfor OAuth2 usage.traits.Serializeable.serializeproperty name changed tofactory.static_requestnow only takes a str for the route.- All manifest methods are accessed through the RESTClient.
fetch_manifestmethod renamed toread_manifest_bytes.
Removed
- Fields from
enums.Itemsince they don't belong to there. - web_app example.
Client.fetch_manifestmethod.- Manifest object
- Python
Published by nxtlo over 4 years ago
https://github.com/nxtlo/aiobungie - Profile Components flow.
Added
- Implemented Bungie profile components.
not all of them. crate.recordswhich implements Bungie record component.__repr__overloaded forenums.Enumwhich just returnsenums.Enum.__str__.Profile.collect_characters()method which fetch and collect all profile characters at once.- Implemented
aiobungie.crate.fireteamsobjects and its methods. RESTClient._requestmethod now takes and extraauthparameter for requests that requiresOAuthheader.- The base client now takes an extra
rest_clientparameter for aRESTClientinstance provided by the user. This is optional and not required. - Chinese attributes to
fireteams.FireteamLanguage - An API interface/abc and docs to the
factory.Factorydeserialazation factory class. This is optional and not required. - A new helper function
helpers.collect()which collect multiple arguments, join them and separate them. - Missing
ComponentTypeenum fields were added. - Implemented
profile.ProfileProgressionprofile component. profile.ProfileItemImplclass implements profile components that returns items. i.e.,profileinventories,profilecurrencies, etc.- More enums for Destiny 2 items.
entity.BaseEntityclass which all entities now inherit from.fetch_objective_entity()method which returnsentity.ObjetiveEntityentity.enums.ComponentTypenow has fieldsALL_Xwhich includes all component fields for a specific component.- Implemented new Activities classes and entities in
crate.activity.
Breaking changes
Profile.collectmethod renamed tocollect_charactersfor consistency.fetch_profileand all alternative methods now takes**optionskwargs which expectsauthargument-fetch_profileand all alternative methods now takes*componentsparameter which accept multiple components to be passed and retuned at once.fetch_profilenow returnscomponents.Componentinstead ofprofile.Profile.fetch_characternow returnscomponents.CharacterComponentinstead ofcharacter.Character.fetch_characterno longer takes a chartype(aiobungie.Class) parameter and takes `characterid` which returns the character by its id instead of type.fetch_characterand all alternative methods now takes*componentsparameter which accept multiple components to be passed and retuned at once and**optionskwargs which expectsauth="BEARER_TOKEN"argument for components that requires a bearer access token.aiobungie.Componentenum name renamed toComponentType.traits.pymoved to the root directory instead of being inhelpers- All type hints used to be in
helpers.pymoved to new moduletypedefs.pyin root directory. undefinedtypes are now inundefined.pynew module.profile.ProfileComponentABC has been removed in favor ofprofile.Profile.Client.serializeproperty name changed toClient.factory.Client.fetch_public_milestone_contentmethod now returnsMilesonteContentinstead ofMilesonte.
Changed
RESTClient._requestnow takes a string orrest.RequestMethodenum for the method.RESTClient._requestnow takesyarl.URLor a string for the path. Both changes affect `RESTClient.static_request.helpers.just()now takes a generic type for the return type hint.helpers.pynow only include helper functions and classes.- Simplify not found raised errors to only raise
error.NotFoundinstead of other not found errors. - Export
enums.Enumandenums.IntEnumtoenums.__all__. RESTClientcontinues onRuntimeErrorerrors instead of raising it.traits.RESTful.static_requestnow takes auth parameter for OAuth2 methods as well.fireteamsenums are finalized withtyping.finalCharacter.statsnow returns a mapping ofaiobungie.Stattointof the character stats.crate.season.*objects are now exposed to docs andcrate.__init__.pyfetch_player()Now requires an extra parametercodeseperatly instead ofNAME#123
Removed
profile.Profilemethodsfetch_warlock,fetch_titan, andfetch_hunterhas been removed since the expected character to be returned wasn't always guranteed, This method has been replaced withcollect_characterswhich fetch all found characters and returns a collection of them.
You can always check for the character class type i.e.,
py
characters_components = await profile.collect_characters(aiobungie.ComponentType.CHARACTERS)
for component in characters_components:
# Check if the character component avilable.
# This should always be available since we passed it to the request.
if character := component.character:
if isinstance(character.class_type, aiobungie.Class.WARLOCK):
...
else:
...
- Not found errors removed and now only error.NotFound is raised instead.
- error.PlayerNotFound
- error.UserNotFound
- error.ActivityNotFound
- error.ClanNotFound
Fixed
- Fixed
Friend.userwas returningUserand notBungieUser - Some methods that required OAuth2 was buggy has been fixed.
- The rest client was showing
unclosed client_sessionerros and the end of the request. Friend.unique_namewasn't returning the actual unique name.Factory.deserialize_friendswasn getting the wrong payload names.- Closing the rest client connector instead of the session.
- Python
Published by nxtlo over 4 years ago
https://github.com/nxtlo/aiobungie - Bug fix for 0.2.5b10.
Fixed
fetch_friendsandfetch_friend_requestsmethods werePOSTand fixed toGET.
- Python
Published by nxtlo over 4 years ago
https://github.com/nxtlo/aiobungie - 0.2.5b10
Added
- New module
milestones.pywithMilestone,MilestoneItemsobjects which implements (not fully) Bungie's Milestones. - Added Stable Python 3.10 to the CI tests from 3.10-dev.
- A new type hint
IntAnd[EnumSig]to pass a param as an enum or just an int. Exampleaiobungie.Class.WARLOCKor simply just2. - Let all methods that used to only takes an enum also supports an int.
- Added _backoff.py for/and Handling ratelimiting and retry after REST errors.
- A new parameter
max_retriestoRESTClientandClientwhich lets you choose the max REST requests retries for failuare requests. - New exception
RateLimitedErrorwhich's raised when being ratelimited. - Import modules under the
typing.TYPE_CHECKINGfor non-runtime modules. - Implemented methods that requires OAuth2 bearer access tokens
kick_clan_membercan be accessed either via theClientwhich returns the deserialized object orRESTClientfor the JSON object.ban_clan_member,unban_clan_membercan be accessed fromRESTClient.edit_clan,edit_clan_optionswhich edits a clan and can be accessed viaRESTClient.equip_item,equip_itemsinRESTClientandcharacter.Characterfetch_own_bungie_usermethods which can be accessed viaRESTClient.deny_pending_members,approve_pending_members,add_optional_conversationmethods toclans.Clan.ClanConversation.editmethod to edit the convo settings.- Implemeted
friends.Friendmethods flow +friends.FriendRequestViewobject. transfer_item,pull_itemmethods.
enums.MembershipOptionenum for group member options.errors.InternalServerErrorexception.traits.RESTfulREST client protocol for theRESTClient.
Removed
player.py/.Playermodule / object has been removed in-replacement ofuser.DestinyUser.
Changed
- PRs that used to look like this
patch/...now should look like thistask/...instead. - Bound the rest response signature
ResponseSigTtoJsonObjectandJsonArray Clan.ownernow returnsNoneif the owner was not found instead ofUNDEFINED.- Separate mock tests from real tests.
- Export
aiobungie/interfacesandaiobungie/cratestoaiobungie/__init__.py - Added real client tests to ci workflow.
- Minor changes to nox pipelines.
- Instead of raising
error.AiobungieErroron5xxerrors.errors.InternalServerErroris not raised. Profile.warlock,Profile.titanandProfile.huntermethod names changed toProfile.fetch_hunter()Profile.fetch_....
Fixed
- Errors now are correctly raised.
fetch_membership_from_idwasn't convertingtypeenum parameter toint.
- Python
Published by nxtlo over 4 years ago
https://github.com/nxtlo/aiobungie - 0.2.5b9 release.
Added
- Two simple examples for both
RESTClientandClientinaiobungie/__init__.pyas an introduction examples. __anter__and__aexit__forRESTClientfor context management and closing the client session correctly.rest._Session()object which now aquires a new aiohttp.ClientSession() for us with our settings.- Added a simple rest example under
RESTClientdoc strings. - Missing docs for
search_users()method - Missing assertions from some of the
Clientmethods. fetch_linked_profiles()Method andprofile.LinkedProfile()implementation for bungie linked profiles.fetch_clan_banners()Method andclans.ClanBannerImplementation for bungie clan banners.- Added a
__repr__method toassets.Image()which just returns__str__(). close()method for theRESTClientwhich closes the client session correctly- Added a new class
helpers.AsyncIteratorforasync for ... in ...support. deserialize_linked_profiles()method to deserialize linked profiles and returnsprofile.LinkedProfile()object.deserialize_clan_banners()method to deserialize clan banners and returnsclans.ClanBanner()object.Okclass which just raisesStopIterationexception forAsyncIterator.- Parameters types for
__anter__and__aexit__methods.
Changed
- Renamed
RESTClient._fetch()toRESTClient._request(). - Switched to pdoc from pdoc3.
- Stable release for
0.2.5Extended from2021-09-30to2021-10-05. - The rest client now aquires the session using
rest._Sessioninstead of usingaiohttp.ClientSessiondirectly. - Changed what was inside
__all__in__init__.pyto let pdoc know whats being included. - Exporting all objects to
__all__incrate/__init__.py/pyito let pdoc include all objects. - Renamed
RESTClient.static_search()tostatic_request()and also added the request method parameter for the user to select instead of only GET methods.
- New dracula/darkmode style for the docs pages.
Removed
__anter__and__aexit__from the base client.from_path()method fromClientwhich can now be accessed fromClient.rest.static_request(...).**kwargsfromClientandRESTClient.fetch_vendor_sales()method fromClient.- Removed
__all__fromaiobungie/internal. - Removed
__init__.pyifromaiobungie/internal.
Fixed
- Fixed a bug where
Factory.deserialize_destiny_user()was returningdisplayNameinstead of the actual value if the LastSeenDisplayName was not found. - Fixed a bug where
Factory.deserialize_clan_members()was raisingKeyErrorfor members the doesn't have a Bungie membership. It returnsNoneintead now. - Fixed the examples to match the client design.
- Python
Published by nxtlo over 4 years ago
https://github.com/nxtlo/aiobungie - Redesign, Bungie user and Destiny members implementation.
Breaking changes
- Renamed
http.pytorest.py. - Renamed
HTTPClienttoRESTClient. - Renamed
impl.pytotraits.py. - Renamed
serialize.pytofactory.py - Renamed The main client protocol
RESTfultoClientBase. - Renamed
Deserializeclass toFactory. - Renamed
Client.httptoClient.rest. - Renamed
JsonDictandJsonListtoJsonObjectandJsonArray. - Renamed
ProfileComponentImpltoProfileComponent. clans.ClanOwner()is removed in-replace ofclans.ClanMember().user.Userattributes has been removed and replaced with two new ones,bungiewhich returnsuser.BungieUse()and destiny which returnsuser.DestinyUser()objects.- Clan member
join_date,is_online,last_onlineattributes currently returnsNonedue to a Bug. - Removed
human_timedeltafromtime.pyand property from all objects that had this method. - Removed
as_dictmethod from all objects that had this method. - Objects that were decorated with
attr.sare now decorated withattr.define - Objects that has a
.iconor.pictureattributes now returnassets.MaybeImageinstead ofassets.Imagewhich returns anImage.partial()incase the object was Undefined or didn't have that field. - Removed
ClanMember.netproperty and converted to a class attr. - Removed
attr.sdecorator from abstracted classes. player.Playerno longer inherit fromUserLike. Also this object is scheduled to be removed and replaced withuser.DestinyUserin0.2.5Stable release.db.pywhich as an sqlite databse associated withManifestwas removed for the user themselves to implement.Manifestnow only provied a method to download it and all other methods was removed. Note that this is still buggy and should be fixed with0.2.5release.
Features
- You're now able to use
rest.RESTClient()for direct low-level interaction with the API which results to.- No Hight-Level, Object-orianted usage.
- All returned data are pure json objects from the API.
- No runtime assertions.
- No Deserialazation. Meaning you'll have to implement you own methods to get your desired results.
- Faster. Since no third party classes, assertions and deserializing happening in the backend. why? Some times people don't need high level client concepts introduced to their applications, So we give them freedom to implement it themselves :)
- Added
interfaces/**module which include abstracted interfaces for objects implementation. - New class
clans.ClanConversation()that implementsGroupV2.GetGroupOptionalConversations. - New class
clans.ClanAdmin()that implementsGroupV2.GetAdminsAndFounderOfGroup. - New class
clans.GroupMember()that implementsGroupV2.GetGroupOptionalConversationsandGroupV2.GetPotentialGroupsForMember. - New class
user.PartialBungieUserthat implements partial bungie net user information. - New class
user.BungieUserwhich wasuser.User. - New class
user.DestinyUserwhich implement a destiny user memberships. - Modified class
user.Useris now modified to return only two attributes which contains bothbungieanddestinyuser memberships. - New
ClanMemberTypeenum for clan memberships types. - New trait
Serializable()to add serialize signature to theClientBase()protocol. - New
restproperty to theClientthat returns the rest client. - New
helpers.UndefinedType()undefined type for data that will results toUNDEFINED,UndefinedOr[T, UndefinedType]which returns aTorUNDEFINEDifTis None. - New
helpers.get_or_make_loop()function that get or creates a new asyncio event loop - New
Client.search_users()method which implement theUser.SearchByGlobalNamePrefix. - New
Client.fetch_membership_from_id()method that implementsUser.GetMembershipDataById. - New
Client.fetch_clan_conversations()method that implementsGroupV2.GetGroupOptionalConversations. - New
Client.fetch_clan_admins()method that implementsGroupV2.GetAdminsAndFounderOfGroup. - New
Client.fetch_groups_for_member()method that implementsGroupV2.GetGroupsForMemberandGroupV2.GetPotentialGroupsForMember - New
ApplicationOwner.fetch_self()method that returnsuser.BungieUser()object of the app owner. - More methods under the almost all objects to make them more flexible.
JsonArraynow takes any type of object instead of onlydict[..., ...].Client.fetch_user()now returnsuser.BungieUserinstead ofuser.User.Client.fetch_player()now returnstyping.Sequence[user.DestinyUser]instead ofplyaer.Player. # Bug fixes- Fix a bug where clan member attrs are duplicate.
- Fix a bug where the rest client wasn't retrying on
5xxerrors. # Meta - Separate CI tests from each other.
- Python
Published by nxtlo over 4 years ago
https://github.com/nxtlo/aiobungie - 0.2.5b7 release.
Break changes
This release includes huge break changes. Like classes renames. functions removed and different behavior to match the new bungie api design.
* Renamed impl.BaseClient main client protocol to impl.RESTful
* Removed Client.fetch_user_from_id since bungie removed this method.
* Client.fetch_user_from_id is now Client.fetch_user
* Client.fetch_player Now requires the full name bungie name with its code, i.e., Fate#1234
* Removed some class attrs from crate.User repr.
* The HTTPClient now raises an error before continuing the request if the API was down.
* All id class attrs that used to return a str object of the id now returns an int object, i.e., '1234' -> 1234.
* Removed PartialUser ABC since it was really slowing things up for no reason.
Features
- New class attr
unique_namethat returns the Bungie user/player's unique name, i.e,Fate#1234. - New class attr
codethat returns the bungie user/player code, i.e,1234. - Optimized HTTP requests speed.
typeparameter is now optional to pass onClient.fetch_player.- Added
ClanMember.typesthat returns all membership types for clan member. - Added
Player.typesthat returns all membership types for player. - Added the version addition to the docs.
- Removed overload methods
__int__and__str__on all userlike crates and added them to the baseUserLikeobject.
Bug fixes
- Fixed a bug where bungie won't allow
301without usingwww.redirect forSearchDestinyPlayerendpoint.
- Python
Published by nxtlo almost 5 years ago
https://github.com/nxtlo/aiobungie - 0.2.5b6 release.
Breaking changes
HTTPClientwill now raiseOSErrorif the Bungie API is shutdown instead of making the request and raising an Unknown error.- Moved package metadata to
_info.py. - Added an aiobungie client
User-Agentkey as an http kwarg.
Features
- Bungie Season basic implementation.
- Removed type hints from
__slots__since mypy is causing errors. - Finished All coverage for the
Userendpoints except one which will be finished by next relese. - Added a code spelling fixes to nox tests which requires the
codespellmodule. - Improved Docstrings for all methods.
Bug Fixes
- Fixed a bug where
joined_at,last_online,group_idandis_onlineattribs were the same for all clan members inClient.fetch_clan_members()
- Python
Published by nxtlo almost 5 years ago
https://github.com/nxtlo/aiobungie - 0.2.5b5 pre-release.
Breaking changes
- objects folder name changed to crate
fetch_activity()now works but still not stable.fetch_activity()parameters names changed fromuserid,charid,memtypetomembed_id,character_id,membership_type.- Removed useless
Attributesdocstrings from all crates.
Features
- A very basic re-implementation of the
Activity/ crate. - A new crate
PostActivitythat returns post activity data. - A new method
Client.fetch_hard_types()which returnsHardLinkedMembershipcrate with the user's hard linked data - A new method
Client.fetch_post_activity()which returns
Bug Fixes.
- Fix relative import errors for some of the modules that won't work without
typing.TYPE_CHECKING.
- Python
Published by nxtlo almost 5 years ago
https://github.com/nxtlo/aiobungie - 0.2.5b4
Breaking changes
UserCardclass name changed toUserLike.http.PreLockclass for thread safety for htto requests.- All Entitiy definitions now inherit from the
Entitymain abc. - All
as_dictmethods has changed into@properties.
Features
- Version bump to
0.2.5b4 ClanMemberobject is fully implemented.- You can now fetch clan members from the
Clanobject usingawait fetch_member("NAME")andawait fetch_members()for the clan members will return all members in a mutable dict contains a clan member name and a their id as the value. example:{"Foo": 19823791283, "Bar": 12391203, ...}. InventoryItementity which'sDestinyInventoryItemDifinitionis implemented but you might find some buggy stuff.- Added a
fetch_inventory_itemmethod which returns anInventoryItementity.
Bug Fixes.
- Minort http error handling.
- The main
fetch()http method is now decorated withtyping.final.
- Python
Published by nxtlo almost 5 years ago
https://github.com/nxtlo/aiobungie - 0.2.5b3 release.
Breaking changes
ProfileComponent reimplementation.Activitycan not be used currently.charactervariable has been removed from theProfilecomponent with an easier access for the characters. see Features.typesmodule has been deleted since we're using class attrs.
Features
Profilecomponent now has 5x faster responses and safer.- Added a
PartialProfileand 3 new async methods toPartialProfile.titan,warlock,hunter. All three returns the selectedCharacterobject instead ofcharacterclass var. - Added a new method in
Time.format_playedthat formats the total played time for characters and players. Profileobject is now serialized.Characterobject is now serialized.- Added a new runtime protocol
RESTfulfor accessing and making rest methods from other objects. - New Errors
Minor Changes
- Better http error handling.
- All http errors now derives from
HTTPException
Bug Fixes.
Profile component fixes and error handling.
- Python
Published by nxtlo almost 5 years ago
https://github.com/nxtlo/aiobungie -
Breaking changes
meta.pyhas been moved toaiobungie/extas a aiobungie extension.- Class
RedisCachehas been renamed toCache. HTTPClient.fetch()now has two more paramaters forManifestclient bindings.
Features
- Manifest now auto-checks for the version and warn if there's a new one.
Minor Changes
- Asserting responses before returning them for catching bugs.
New Modules
db.py for Bungie manifest database.
Bug Fixes.
HTTPClientnow only raises the error message instead of the whole data.- Better error handling for the manifest.
- README fixes for the python versions tags.
- Python
Published by nxtlo almost 5 years ago
https://github.com/nxtlo/aiobungie - 0.2.5b1 release.
Breaking changes
- types module being cleaned. Why? because i'm switching from
TypedDictto attrs module and ABCs, which's way cleaner and faster. - A new module
serialize.pyfor deserializing objetcs then passing them to the http request for cleaner and faster access methods. - a new module
impl.pywhich will include all typing protocols and implementaions of other clients. - Now all user like objects will inherit from
UserCardabc. i.e.,Player,ClanOwner. - OAuth2 is now dropped since my focus on this lib is not OAuth.
human_timeproperty is renamed tohuman_timedelta.Clientnow inherits from the base runtime protocolimpl.BaseClient.
Features
- Version Bumped to Beta 1 and ready for testing.
- Added
BaseCacheimplementation protocol for cache access fromBaseClient. - Objects Speed optimization.
- Redis Hash cache now can be accessed from
Clientfor cache testing purposes. - New return types in
helpers.py,JsonDictandJsonList. http.pyrequests now returnJsonDictorJsonListdepends on the returned data. Returned are now deserialized inclient.py.- Removed all types except
character.pyandprofile.pyandactivity.pywhich will be deleted and moved as anabcclasses in 0.2.5 Stable release. - Added a
.linkproperty which will return the url of the objects, this can be aClanOwner,ApplicationOwneror any User like object. - Added
BUNGIEenum as aMembershipType
New Modules
impl.pyincludes every base client runtime protocol.serialize.pyincludes data and objects deserialazition.
Removed
oauth.pyalready mentioned above.security.pywas a helper module foroauth.py.
Paused
Manifestis currently not being worked on until i finish all objects implementation.
Bug Fixes.
HTTPClientwas not raisingHTTPExceptionon http errors.
- Python
Published by nxtlo almost 5 years ago
https://github.com/nxtlo/aiobungie -
Breaking changes
Features
- Better Error messages on http.py and all objects.
- Added examples.
- Added a new exception for handling Components using
ComponentError - Added
__aenter__forasync withsupport. - Supports Python 3.10dev
Bug Fixes.
PlayerreturnsTypeErrorwhen a player is not found and not raising the actual error.- Removed
charactersfromas_dictmethod onProfilebecause it was causing errors when fetching a profile component.
- Python
Published by nxtlo almost 5 years ago
https://github.com/nxtlo/aiobungie - Alpha3 0.2.5
Breaking changes
- utils folder name changed to internal
- All enums starts with Destiny* changed to its name Only i.e.
- DestinyClass -> Class
- DestinynGender -> Gender
- etc.
Features
- Profile Implementaion and types
- base urls are now in
url.py - Added
as_dict()method which returns a dict object of the class to all objects. fetch_profile()function currently works for the profile and character component only- More enums
- The
meta.pymodule wich includeManifestclass stuff now works. - all
__repr__()methods now return the string of the enums instead of theint for better readability. - docs are now in master.
Bug Fixes.
HTTPClientreturning text during 404 errors instead of raisingNotFound- General
Characterobject fixes.
- Python
Published by nxtlo almost 5 years ago