Skip to main content

execute discord webhooks

Project description

# python-discord-webhook

execute discord webhooks

## Examples

execute basic webhook
```python
from discord_webhook.webhook import DiscordWebhook

webhook = DiscordWebhook(url='your webhook url', content='Webhook Message')
webhook.execute()
```

execute webhook with embedded content
```python
from discord_webhook.webhook import DiscordWebhook, DiscordEmbed

webhook = DiscordWebhook(url='your webhook url')

# create embed object for webhook
embed = DiscordEmbed(title='Your Title', description='Lorem ipsum dolor sit', color=242424)

# add embed object to webhook
webhook.add_embed(embed)

webhook.execute()
```

add some data to embedded content
```python
from discord_webhook.webhook import DiscordWebhook, DiscordEmbed

webhook = DiscordWebhook(url='your webhook url')

# create embed object for webhook
embed = DiscordEmbed(title='Your Title', description='Lorem ipsum dolor sit', color=242424)

# set author
embed.set_author(name='Author Name', url='author url', icon_url='author icon url')

# set image
embed.set_image(url='your image url')

# set thumbnail
embed.set_thumbnail(url='your thumbnail url')

# set footer
embed.set_footer(text='Embed Footer Text')

# set timestamp (default is now)
embed.set_timestamp()

# add embed object to webhook
webhook.add_embed(embed)

# add fields to embed
embed.add_embed_field(name='Field 1', value='Lorem ipsum')
embed.add_embed_field(name='Field 2', value='dolor sit')

webhook.execute()
```

This is another example with the result as a screenshot
```python
from discord_webhook.webhook import DiscordWebhook, DiscordEmbed

url = "https://discordapp.com/api/webhooks/480440103915880451/RF96yIqrbp10HZRJEYRdjwn4iQYhlk1eNtsKB-FGTFMPg09fcoPqGIBwSI_kzXqzi9GY"
webhook = DiscordWebhook(url=url, username="New Webhook Username")

embed = DiscordEmbed(title='Embed Title', description='Your Embed Description', color=242424)
embed.set_author(name='Author Name', url='https://github.com/lovvskillz', icon_url='https://avatars0.githubusercontent.com/u/14542790')
embed.set_footer(text='Embed Footer Text')
embed.set_timestamp()
embed.add_embed_field(name='Field 1', value='Lorem ipsum')
embed.add_embed_field(name='Field 2', value='dolor sit')
embed.add_embed_field(name='Field 3', value='amet consetetur')
embed.add_embed_field(name='Field 4', value='sadipscing elitr')

webhook.add_embed(embed)
webhook.execute()

```

![Image](https://cdn.discordapp.com/attachments/480439896478187550/480751239806582785/unknown.png "Example Result")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discord-webhook-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

discord_webhook-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file discord-webhook-0.1.0.tar.gz.

File metadata

  • Download URL: discord-webhook-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for discord-webhook-0.1.0.tar.gz
Algorithm Hash digest
SHA256 015030170e7ab6a2623b9d2bb7f44cfdc07252ed11c07510dd970f7394e1b524
MD5 88d450e20793bd96c28466594be2b319
BLAKE2b-256 3d7dc7bbea94c8341618c77b2e4606a108d9a48c603d592b18b9a2cdb584e848

See more details on using hashes here.

File details

Details for the file discord_webhook-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: discord_webhook-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for discord_webhook-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2fe3e75e3f8f7fe6f0f4586913fe215d7e2eefd06678f9c0725f5b9a0e4d20bb
MD5 fcee2c0cf5fe506c176ff3abff32ee19
BLAKE2b-256 1fd6824cd64e6a993225a2265a4a2311fdc5ee3332020606023bbfe67ae2fcf5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page