Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Asset.read() to retrieve assets into bytes objects #2107

Merged
merged 1 commit into from Apr 20, 2019

Conversation

@slice
Copy link
Contributor

commented Apr 20, 2019

Summary

This PR adds Asset.read. It makes

my_bytes = await my_asset.read()

equivalent to

async with aiohttp.ClientSession() as session:
    my_bytes = await session.get(str(my_asset))

Additional Notes

  • Changed a usage of Asset inside of a @classmethod to cls.
  • The reason for HTTPException being raised was changed from Saving the asset failed. to Downloading the asset failed.
  • Asset.save was refactored to use Asset.read.
  • Reworded warning about user created PartialEmoji and the circumstances in which an Asset's URL can be None.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@Rapptz Rapptz merged commit d80d414 into Rapptz:master Apr 20, 2019

@slice slice deleted the slice:feature/asset-read branch Apr 20, 2019

@Rapptz Rapptz added this to the v1.1 milestone May 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.