execute discord webhooks
Project description
# python-discord-webhook
[](https://raw.githubusercontent.com/lovvskillz/python-discord-webhook/master/LICENSE)
[](https://badge.fury.io/py/discord-webhook)
execute discord webhooks
## Install
install via pip: `pip install discord-webhook`
## Examples
### basic webhook
```python
from discord_webhook.webhook import DiscordWebhook
webhook = DiscordWebhook(url='your webhook url', content='Webhook Message')
webhook.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()
```

```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 fields to embed
embed.add_embed_field(name='Field 1', value='Lorem ipsum')
embed.add_embed_field(name='Field 2', value='dolor sit')
# add embed object to webhook
webhook.add_embed(embed)
webhook.execute()
```

This is another example with embedded content
```python
from discord_webhook.webhook import DiscordWebhook, DiscordEmbed
webhook = DiscordWebhook(url='your webhook 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()
```

### send files
```python
from discord_webhook.webhook import DiscordWebhook, DiscordEmbed
webhook = DiscordWebhook(url='your webhook url', username="Webhook with files")
# send two images
with open("path/to/first/image.jpg", "rb") as f:
webhook.add_file(file=f.read(), filename='example.jpg')
with open("path/to/second/image.jpg", "rb") as f:
webhook.add_file(file=f.read(), filename='example2.jpg')
webhook.execute()
```

### use proxies
```python
from discord_webhook.webhook import DiscordWebhook
proxies = {
'http': 'http://10.10.1.10:3128',
'https': 'http://10.10.1.10:1080',
}
webhook = DiscordWebhook(url='your webhook url', content='Webhook Message', proxies=proxies)
webhook.execute()
```
or
```python
from discord_webhook.webhook import DiscordWebhook
proxies = {
'http': 'http://10.10.1.10:3128',
'https': 'http://10.10.1.10:1080',
}
webhook = DiscordWebhook(url='your webhook url', content='Webhook Message')
webhook.set_proxies(proxies)
webhook.execute()
```
[](https://raw.githubusercontent.com/lovvskillz/python-discord-webhook/master/LICENSE)
[](https://badge.fury.io/py/discord-webhook)
execute discord webhooks
## Install
install via pip: `pip install discord-webhook`
## Examples
### basic webhook
```python
from discord_webhook.webhook import DiscordWebhook
webhook = DiscordWebhook(url='your webhook url', content='Webhook Message')
webhook.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()
```

```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 fields to embed
embed.add_embed_field(name='Field 1', value='Lorem ipsum')
embed.add_embed_field(name='Field 2', value='dolor sit')
# add embed object to webhook
webhook.add_embed(embed)
webhook.execute()
```

This is another example with embedded content
```python
from discord_webhook.webhook import DiscordWebhook, DiscordEmbed
webhook = DiscordWebhook(url='your webhook 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()
```

### send files
```python
from discord_webhook.webhook import DiscordWebhook, DiscordEmbed
webhook = DiscordWebhook(url='your webhook url', username="Webhook with files")
# send two images
with open("path/to/first/image.jpg", "rb") as f:
webhook.add_file(file=f.read(), filename='example.jpg')
with open("path/to/second/image.jpg", "rb") as f:
webhook.add_file(file=f.read(), filename='example2.jpg')
webhook.execute()
```

### use proxies
```python
from discord_webhook.webhook import DiscordWebhook
proxies = {
'http': 'http://10.10.1.10:3128',
'https': 'http://10.10.1.10:1080',
}
webhook = DiscordWebhook(url='your webhook url', content='Webhook Message', proxies=proxies)
webhook.execute()
```
or
```python
from discord_webhook.webhook import DiscordWebhook
proxies = {
'http': 'http://10.10.1.10:3128',
'https': 'http://10.10.1.10:1080',
}
webhook = DiscordWebhook(url='your webhook url', content='Webhook Message')
webhook.set_proxies(proxies)
webhook.execute()
```
Project details
Release history Release notifications | RSS feed
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.3.0.tar.gz
(4.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discord-webhook-0.3.0.tar.gz.
File metadata
- Download URL: discord-webhook-0.3.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59fac5b7c32168add69838291cbe5c8d87588f7c0969b4eecfd1294ea1f83952
|
|
| MD5 |
3f0282b14bf25473783b6b6ab0903f45
|
|
| BLAKE2b-256 |
b95f0c8238fdac641ccd7cb6bd16cd0f5d07b2411478150bfa10cba095c8deae
|
File details
Details for the file discord_webhook-0.3.0-py3-none-any.whl.
File metadata
- Download URL: discord_webhook-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.4 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.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bbc032e33b47ba0412b92c62e8904fa769376391eb491d65ef6b2c9b86fe839
|
|
| MD5 |
a9d6343fea362728e5e0620248011a79
|
|
| BLAKE2b-256 |
515eb17c560b8fe7baf327fe0d6391f3b37865b9a0684aecf4e679d15809d1f1
|