# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['discord_webhook']

package_data = \
{'': ['*']}

install_requires = \
['requests>=2.28.1,<3.0.0']

extras_require = \
{'async': ['httpx>=0.23.0,<0.24.0']}

entry_points = \
{'console_scripts': ['discord_webhook = discord_webhook.__main__:main']}

setup_kwargs = {
    'name': 'discord-webhook',
    'version': '1.0.0',
    'description': 'execute discord webhooks',
    'long_description': '# python-discord-webhook\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://raw.githubusercontent.com/lovvskillz/python-discord-webhook/master/LICENSE)\n[![PyPI version](https://badge.fury.io/py/discord-webhook.svg)](https://badge.fury.io/py/discord-webhook)\n[![Downloads](https://pepy.tech/badge/discord-webhook)](https://pepy.tech/project/discord-webhook)\n\nExecute Discord Webhooks (also has [async support](#async-support))\n\n## Install\n\nInstall via pip:\n```\npip install discord-webhook\n```\n\n## Examples\n\n* [Basic Webhook](#basic-webhook)\n* [Create Multiple Instances](#create-multiple-instances)\n* [Manage Being Rate Limited](#manage-being-rate-limited)\n* [Multiple Webhook Urls](#multiple-webhook-urls)\n* [Embedded Content](#webhook-with-embedded-content)\n* [Edit Webhook Message](#edit-webhook-messages)\n* [Delete Webhook Message](#delete-webhook-messages)\n* [Send Files](#send-files)\n* [Remove Embeds and Files](#remove-embeds-and-files)\n* [Allowed Mentions](#allowed-mentions)\n* [Use Proxies](#use-proxies)\n* [Timeout](#timeout)\n* [Async Support](#async-support)\n\n### Basic Webhook\n\n```python\nfrom discord_webhook import DiscordWebhook\n\nwebhook = DiscordWebhook(url=\'your webhook url\', content=\'Webhook Message\')\nresponse = webhook.execute()\n```\n\n### Create multiple instances\n\n```python\nfrom discord_webhook import DiscordWebhook\n\n# you can provide any kwargs except url\nwebhook1, webhook2 = DiscordWebhook.create_batch(urls=[\'first url\', \'second url\'], content=\'Webhook Message\')\nresponse1 = webhook1.execute()\nresponse2 = webhook2.execute()\n```\n\n### Manage being Rate Limited\n\n```python\nfrom discord_webhook import DiscordWebhook\n\n# if rate_limit_retry is True then in the event that you are being rate \n# limited by Discord your webhook will automatically be sent once the \n# rate limit has been lifted\nwebhook = DiscordWebhook(url=\'your webhook url\', rate_limit_retry=True,\n                         content=\'Webhook Message\')\nresponse = webhook.execute()\n```\n\n![Image](img/basic_webhook.png "Basic Example Result")\n\n### Multiple Webhook URLs\n\n```python\nfrom discord_webhook import DiscordWebhook\n\nwebhook_urls = [\'webhook url 1\', \'webhook url 2\']\nwebhook = DiscordWebhook(url=webhook_urls, content=\'Webhook Message\')\nresponse = webhook.execute()\n```\n\n![Image](img/multiple_urls.png "Multiple Urls Result")\n\n### Webhook with Embedded Content\n\n```python\nfrom discord_webhook import DiscordWebhook, DiscordEmbed\n\nwebhook = DiscordWebhook(url=\'your webhook url\')\n\n# create embed object for webhook\n# you can set the color as a decimal (color=242424) or hex (color=\'03b2f8\') number\nembed = DiscordEmbed(title=\'Your Title\', description=\'Lorem ipsum dolor sit\', color=\'03b2f8\')\n\n# add embed object to webhook\nwebhook.add_embed(embed)\n\nresponse = webhook.execute()\n```\n\n![Image](img/simple_embed.png "Basic Embed Example Result")\n\n```python\nfrom discord_webhook import DiscordWebhook, DiscordEmbed\n\nwebhook = DiscordWebhook(url=\'your webhook url\')\n\n# create embed object for webhook\nembed = DiscordEmbed(title=\'Your Title\', description=\'Lorem ipsum dolor sit\', color=\'03b2f8\')\n\n# set author\nembed.set_author(name=\'Author Name\', url=\'author url\', icon_url=\'author icon url\')\n\n# set image\nembed.set_image(url=\'your image url\')\n\n# set thumbnail\nembed.set_thumbnail(url=\'your thumbnail url\')\n\n# set footer\nembed.set_footer(text=\'Embed Footer Text\', icon_url=\'URL of icon\')\n\n# set timestamp (default is now)\nembed.set_timestamp()\n\n# add fields to embed\nembed.add_embed_field(name=\'Field 1\', value=\'Lorem ipsum\')\nembed.add_embed_field(name=\'Field 2\', value=\'dolor sit\')\n\n# add embed object to webhook\nwebhook.add_embed(embed)\n\nresponse = webhook.execute()\n```\n\n![Image](img/extended_embed.png "Basic Embed Example Result")\n\nThis is another example with embedded content\n\n```python\nfrom discord_webhook import DiscordWebhook, DiscordEmbed\n\nwebhook = DiscordWebhook(url=\'your webhook url\', username="New Webhook Username")\n\nembed = DiscordEmbed(title=\'Embed Title\', description=\'Your Embed Description\', color=\'03b2f8\')\nembed.set_author(name=\'Author Name\', url=\'https://github.com/lovvskillz\', icon_url=\'https://avatars0.githubusercontent.com/u/14542790\')\nembed.set_footer(text=\'Embed Footer Text\')\nembed.set_timestamp()\nembed.add_embed_field(name=\'Field 1\', value=\'Lorem ipsum\')\nembed.add_embed_field(name=\'Field 2\', value=\'dolor sit\')\nembed.add_embed_field(name=\'Field 3\', value=\'amet consetetur\')\nembed.add_embed_field(name=\'Field 4\', value=\'sadipscing elitr\')\n\nwebhook.add_embed(embed)\nresponse = webhook.execute()\n```\n\n![Image](img/extended_embed2.png "Example Embed Result")\n\nBy Default, the Embed fields are placed side by side. We can arrange them in a new line by setting `inline=False` as follows:\n\n```python\nfrom discord_webhook import DiscordWebhook, DiscordEmbed\n\nwebhook = DiscordWebhook(url="your webhook url", username="New Webhook Username")\n\nembed = DiscordEmbed(\n    title="Embed Title", description="Your Embed Description", color=\'03b2f8\'\n)\nembed.set_author(\n    name="Author Name",\n    url="https://github.com/lovvskillz",\n    icon_url="https://avatars0.githubusercontent.com/u/14542790",\n)\nembed.set_footer(text="Embed Footer Text")\nembed.set_timestamp()\n# Set `inline=False` for the embed field to occupy the whole line\nembed.add_embed_field(name="Field 1", value="Lorem ipsum", inline=False)\nembed.add_embed_field(name="Field 2", value="dolor sit", inline=False)\nembed.add_embed_field(name="Field 3", value="amet consetetur")\nembed.add_embed_field(name="Field 4", value="sadipscing elitr")\n\nwebhook.add_embed(embed)\nresponse = webhook.execute()\n```\n\n![Image](img/extended_embed3.png "Example Non-Inline Embed Result")\n\n### Edit Webhook Messages\n\n```python\nfrom discord_webhook import DiscordWebhook\nfrom time import sleep\n\nwebhook = DiscordWebhook(url=\'your webhook url\', content=\'Webhook content before edit\')\nwebhook.execute()\nwebhook.content = \'After Edit\'\nsleep(10)\nwebhook.edit()\n```\n\n### Delete Webhook Messages\n\n```python\nfrom discord_webhook import DiscordWebhook\nfrom time import sleep\n\nwebhook = DiscordWebhook(url=\'your webhook url\', content=\'Webhook Content\')\nwebhook.execute()\nsleep(10)\nwebhook.delete()\n```\n\n### Send Files\n\n```python\nfrom discord_webhook import DiscordWebhook\n\nwebhook = DiscordWebhook(url=\'your webhook url\', username="Webhook with files")\n\n# send two images\nwith open("path/to/first/image.jpg", "rb") as f:\n    webhook.add_file(file=f.read(), filename=\'example.jpg\')\nwith open("path/to/second/image.jpg", "rb") as f:\n    webhook.add_file(file=f.read(), filename=\'example2.jpg\')\n\nresponse = webhook.execute()\n```\n\n![Image](img/webhook_files.png "Example Files Result")\n\nYou can use uploaded attachments in Embeds:\n\n```python\nfrom discord_webhook import DiscordWebhook, DiscordEmbed\n\nwebhook = DiscordWebhook(url=\'your webhook url\')\n\nwith open("path/to/image.jpg", "rb") as f:\n    webhook.add_file(file=f.read(), filename=\'example.jpg\')\n\nembed = DiscordEmbed(title=\'Embed Title\', description=\'Your Embed Description\', color=\'03b2f8\')\nembed.set_thumbnail(url=\'attachment://example.jpg\')\n\nwebhook.add_embed(embed)\nresponse = webhook.execute()\n```\n\n### Remove Embeds and Files\n\n```python\nfrom discord_webhook import DiscordWebhook, DiscordEmbed\n\nwebhook = DiscordWebhook(url=\'your webhook url\')\n\nwith open("path/to/image.jpg", "rb") as f:\n    webhook.add_file(file=f.read(), filename=\'example.jpg\')\n\nembed = DiscordEmbed(title=\'Embed Title\', description=\'Your Embed Description\', color=\'03b2f8\')\nembed.set_thumbnail(url=\'attachment://example.jpg\')\n\nwebhook.add_embed(embed)\nresponse = webhook.execute(remove_embeds=True, remove_files=True)\n# webhook.files and webhook.embeds will be empty after webhook is executed\n# You could also manually call the functions webhook.remove_files() and webhook.remove_embeds()\n```\n\n`.remove_file()` removes the given file\n\n```python\nfrom discord_webhook import DiscordWebhook\n\nwebhook = DiscordWebhook(url=\'your webhook url\', username="Webhook with files")\n\n# send two images\nwith open("path/to/first/image.jpg", "rb") as f:\n    webhook.add_file(file=f.read(), filename=\'example.jpg\')\nwith open("path/to/second/image.jpg", "rb") as f:\n    webhook.add_file(file=f.read(), filename=\'example2.jpg\')\n# remove \'example.jpg\'\nwebhook.remove_file(\'example.jpg\')\n# only \'example2.jpg\' is sent to the webhook\nresponse = webhook.execute()\n```\n\n### Allowed Mentions\n\nLook into the [Discord Docs](https://discord.com/developers/docs/resources/channel#allowed-mentions-object) for examples and for more explanation\n\nThis example would only ping user `123` and `124` but not everyone else.\n\n```python\nfrom discord_webhook import DiscordWebhook\n\ncontent = "@everyone say hello to our new friends <@123> and <@124>"\nallowed_mentions = {\n    "users": ["123", "124"]\n}\n\nwebhook = DiscordWebhook(url=\'your webhook url\', content=content, allowed_mentions=allowed_mentions)\nresponse = webhook.execute()\n```\n\n### Use Proxies\n\n```python\nfrom discord_webhook import DiscordWebhook\n\nproxies = {\n  \'http\': \'http://10.10.1.10:3128\',\n  \'https\': \'http://10.10.1.10:1080\',\n}\nwebhook = DiscordWebhook(url=\'your webhook url\', content=\'Webhook Message\', proxies=proxies)\nresponse = webhook.execute()\n```\nor\n```python\nfrom discord_webhook import DiscordWebhook\n\nproxies = {\n  \'http\': \'http://10.10.1.10:3128\',\n  \'https\': \'http://10.10.1.10:1080\',\n}\nwebhook = DiscordWebhook(url=\'your webhook url\', content=\'Webhook Message\')\nwebhook.set_proxies(proxies)\nresponse = webhook.execute()\n```\n\n### Use CLI\n\n```\nusage: discord_webhook [-h] -u URL [URL ...] -c CONTENT [--username USERNAME]\n                       [--avatar_url AVATAR_URL]\n\nTrigger discord webhook(s).\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -u URL [URL ...], --url URL [URL ...]\n                        Webhook(s) url(s)\n  -c CONTENT, --content CONTENT\n                        Message content\n  --username USERNAME   override the default username of the webhook\n  --avatar_url AVATAR_URL\n                        override the default avatar of the webhook\n```\n\n### Timeout\n\n```python\nfrom requests.exceptions import Timeout\nfrom discord_webhook import DiscordWebhook, DiscordEmbed\n\n# We will set ridiculously low timeout threshold for testing purposes\nwebhook = DiscordWebhook(url=\'your webhook url\', timeout=0.1)\n\n# You can also set timeout later using\n# webhook.timeout = 0.1\n\nembed = DiscordEmbed(title=\'Embed Title\', description=\'Your Embed Description\', color=\'03b2f8\')\n\nwebhook.add_embed(embed)\n\n# Handle timeout exception\ntry:\n    response = webhook.execute()\nexcept Timeout as err:\n    print(f\'Oops! Connection to Discord timed out: {err}\')\n```\n\n### Async support\nIn order to use the async version, you need to install the package using:\n```\npip install discord-webhook[async]\n```\nExample usage:\n```python\nimport asyncio\nfrom discord_webhook import AsyncDiscordWebhook\n\n\nasync def send_webhook(message):\n    webhook = AsyncDiscordWebhook(url=\'your webhook url\', content=message)\n    await webhook.execute()\n\n\nasync def main():\n    await asyncio.gather(\n        send_webhook(\'Async webhook message 1\'),\n        send_webhook(\'Async webhook message 2\'),\n    )  # sends both messages asynchronously\n\n\nasyncio.run(main())\n```\n\n## Development\n\n### Dev Setup\nThis project uses [Poetry](https://python-poetry.org/docs/) for dependency management and packaging.\n\nInstall Poetry and add Poetry to [Path](https://python-poetry.org/docs/#installation).\n\n**Debian / Ubuntu / Mac**\n\n`curl -sSL https://install.python-poetry.org | python3 -`\n\n**Windows**\n\nopen powershell and run: `(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -`\n\nInstall dependencies: `poetry install`\n\nInstall the defined pre-commit hooks: `poetry run pre-commit install`\n\nActivate the virtualenv: `poetry shell`',
    'author': 'lovvskillz',
    'author_email': '14542790+lovvskillz@users.noreply.github.com',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/lovvskillz/python-discord-webhook',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'extras_require': extras_require,
    'entry_points': entry_points,
    'python_requires': '>=3.8,<4.0',
}


setup(**setup_kwargs)
