kyb3r / dhooks Goto Github PK
View Code? Open in Web Editor NEWA simple python Discord webhook API wrapper
Home Page: https://discord.gg/etJNHCQ
License: MIT License
A simple python Discord webhook API wrapper
Home Page: https://discord.gg/etJNHCQ
License: MIT License
Possible changes to setup.py
:
url
import os
from setuptools import setup, find_packages
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
setup(
name='dhooks',
packages=find_packages(),
version='1.0.8',
description='An (a)sync wrapper for discord webhooks',
long_description=read('README.md'),
long_description_content_type='text/markdown',
license='MIT',
keywords=['discord', 'webhooks', 'discordwebhooks', 'discordhooks'],
install_requires=['aiohttp', 'requests'],
python_requires='>=3.5',
url='https://github.com/4rqm/dhooks/',
project_urls={
'Issue Tracker': 'https://github.com/4rqm/dhooks/issues',
'Documentation': 'https://dhooks.readthedocs.io/'
},
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Natural Language :: English',
'Topic :: Communications :: Chat',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules'
]
)
Other suggestions:
author
and possibly an author_email
Reference for using markdown in PyPi long description:
https://stackoverflow.com/questions/26737222/pypi-description-markdown-doesnt-work
Hi there, I am getting the following error:
Traceback (most recent call last):
File "test.py", line 1, in <module>
from dhooks import Webhook
File "/home/fs/.local/lib/python3.6/site-packages/dhooks/__init__.py", line 1, in <module>
from .client import Webhook
File "/home/fs/.local/lib/python3.6/site-packages/dhooks/client.py", line 118
URL_REGEX = r'^(?:https?://)?((canary|ptb)\.)?discordapp\.com/api/webhooks/' \
Id appreciate any help, thank you!
Although this issue is a newbie issue, on my end it's not. I have checked that it's installed using the right version of pip for python 3
pip3 install dhooks
and it returns that it's installed already. So I double checked using
pip3 list
and it spits back a whole list showing dhooks is at 1.1.4
I am using python3 for my project and can't seem to figure out what the issue is.
Update: I found out that this issue is only within an IDE, when I execute a command to run this script in a python IDE shell it runs perfectly fine.
I'm in frustration RN. Don't know how to create a Webhook object with determined channel ID or change this field when object is initialized.
For now I can only send message to main channel.
In the about command
there is a part where it is written as
Want Modmail in Your Server?
Follow the installation guide on GitHub and join our Discord server!
in the Discord server! place it is given the link as https://discord.gg/F34cRU8/
but it shud be https://discord.gg/F34cRU8 (without the "/" in the last) because when it has the "/" it is redirecting us to discord.com Please update (fix) it!
Thanks!
What's the code for the colour?
I have 2 separate scripts each sending embeds to different web hook URLS, when I run them individually I get no issues, but when I run both at the same time after a while I hit the following error on either one out of the two scripts, seemingly when they both try to send an embed using their respective web hook URL around the same time: "ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)"
Configuration details:
Error segment that contains this message (note, this segment is the only one that directly references my original code, and it specifically references the line where I try and send the embed, this has lead me to believe it has to do with dhooks and not selenium, which is what I originally thought was my issue):
Traceback (most recent call last):
File "C:\Users\User\Documents\python\waifu\new_waifus.py", line 113, in
hook.send(embed=embed)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\dhooks\client.py", line 275, in send
return self._request('POST', payload, file=file)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\dhooks\client.py", line 359, in _request
resp = self.session.post(self.url, json=payload,
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\sessions.py", line 635, in post
return self.request("POST", url, data=data, json=json, **kwargs)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\adapters.py", line 547, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
Entire error message:
Traceback (most recent call last):
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "", line 3, in raise_from
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "C:\Program Files\Python39\lib\http\client.py", line 1377, in getresponse
response.begin()
File "C:\Program Files\Python39\lib\http\client.py", line 320, in begin
version, status, reason = self._read_status()
File "C:\Program Files\Python39\lib\http\client.py", line 281, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Program Files\Python39\lib\socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "C:\Program Files\Python39\lib\ssl.py", line 1242, in recv_into
return self.read(nbytes, buffer)
File "C:\Program Files\Python39\lib\ssl.py", line 1100, in read
return self._sslobj.read(len, buffer)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\util\retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\packages\six.py", line 769, in reraise
raise value.with_traceback(tb)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "", line 3, in raise_from
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "C:\Program Files\Python39\lib\http\client.py", line 1377, in getresponse
response.begin()
File "C:\Program Files\Python39\lib\http\client.py", line 320, in begin
version, status, reason = self._read_status()
File "C:\Program Files\Python39\lib\http\client.py", line 281, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Program Files\Python39\lib\socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "C:\Program Files\Python39\lib\ssl.py", line 1242, in recv_into
return self.read(nbytes, buffer)
File "C:\Program Files\Python39\lib\ssl.py", line 1100, in read
return self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\Documents\python\waifu\new_waifus.py", line 113, in
hook.send(embed=embed)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\dhooks\client.py", line 275, in send
return self._request('POST', payload, file=file)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\dhooks\client.py", line 359, in _request
resp = self.session.post(self.url, json=payload,
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\sessions.py", line 635, in post
return self.request("POST", url, data=data, json=json, **kwargs)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\adapters.py", line 547, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
My test code:
import asyncio
import dhooks
import aiohttp
import selectors
async def main():
hook = dhooks.Webhook("url", is_async=True)
await hook.send('hello')
await hook.modify('bob')
await hook.get_info()
await hook.delete() # since we await it, we have to return a corutine or simular, but method delete will return None
await hook.close() # close the client session
# monkeypatch for windows machine
selector = selectors.SelectSelector()
loop = asyncio.SelectorEventLoop(selector)
asyncio.set_event_loop(loop)
loop.run_until_complete(main())
Error:
C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\dhooks\client.py:323: RuntimeWarning: coroutine 'Webhook._async_request' was never awaited
self._request(method='DELETE')
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/-/-/-/-/dev/async_error.py", line 20, in <module>
loop.run_until_complete(main())
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "C:/Users/Administrator/PycharmProjects/-/-/-/-/dev/async_error.py", line 12, in main
await hook.delete()
TypeError: object NoneType can't be used in 'await' expression
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000020B56C3BD30>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x0000020B56C4E1C0>, 1322769.828)]']
connector: <aiohttp.connector.TCPConnector object at 0x0000020B56C3BD60>
Fix:
# dhooks/client.py
# line 318 -323
def delete(self) -> 'Webhook':
"""
Deletes the :class:`Webhook` permanently.
"""
return self._request(method='DELETE')
# and since we return now the webhook object again it would be good to delete it in some way with an if statement in the _request method after it was executed, (if method == "DELETE: )
Title
I tried to submit a PR for this issue but kept getting 403 error no matter what I tried. The regex used for verifying the webhook URL doesn't handle ptb.discordapp servers.
This:
URL_REGEX = r'^(?:https?://)?(canary\.)?discordapp\.com/api/webhooks/' \ r'(?P<id>[0-9]+)/(?P<token>[A-Za-z0-9\.\-\_]+)/?$'
Should be changed to this:
URL_REGEX = r'^(?:https?://)?((canary|ptb)\.)?discordapp\.com/api/webhooks/' \ r'(?P<id>[0-9]+)/(?P<token>[A-Za-z0-9\.\-\_]+)/?$'
Thanks
I tried ran the embed.py
and it doesnt work at all.. Yes I did put my webhook there.
I don't know about setup.py but it failed to install or given error but it close the cmd so fast. I don't know the errors anyway
I did pip install dhooks and already installed for now...
My python version is 3.6.4
My pip version is 19.1.1
Hi,
maybe a basic question, but can' t find the glue. I able to get the webhook guild_id, but i need to get the guild real name. Is it possible with dhooks or discord.py or another way ? (i have try with discord.py fetch_guild but it failed)
Thanks!
Unfortunately, I was busy for many months and couldn't maintain this project. I wrote this in my early coding days and as you can see the code is fairly trash. I'm surprised that it has gained some traction and I am extremely sorry for those that made pull requests that were left unanswered. Soon this project will be refactored and remade for a better API. I'll also license this under MIT.
Upcoming features.
Update dhooks bcz Now discord has changed discordapp.com to doscord.com
Hi there,
I was wondering if we are able to set URL Buttons as well?
Not sure how to make the author field have a link in it. Let me know if you have this.
i keep getting this error when trying to send a webhook embed
Traceback (most recent call last):
File "C:\Users\Daniel\Documents\python\hypemonitor\test.py", line 99, in <module>
supreme_monitor.main_loop()
File "C:\Users\Daniel\Documents\python\hypemonitor\test.py", line 86, in main_loop
self.send_restock_discord_webhook(temp)
File "C:\Users\Daniel\Documents\python\hypemonitor\test.py", line 60, in send_restock_discord_webhook
webhook.send(embed=embed)
File "C:\Users\Daniel\AppData\Local\Programs\Python\Python38\lib\site-packages\dhooks\client.py", line 275, in send
return self._request('POST', payload, file=file)
File "C:\Users\Daniel\AppData\Local\Programs\Python\Python38\lib\site-packages\dhooks\client.py", line 388, in _request
resp.raise_for_status()
File "C:\Users\Daniel\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\models.py", line 941, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://discord.com/api/webhooks/...
Need help with documentation and examples. Preferably numpy style docs so I can sphinx them later on.
I already read the READMD.
But for some reason it doesn't work at all... and doesnt send the message which i already put the full webhook link
https://prnt.sc/oeacva
already installed the dhooks
The code:
async def on_guild_remove(self, guild):
if guild.icon_url is "":
guildicon = "https://cdn.discordapp.com/attachments/443347566231289856/513380120451350541/2mt196.jpg"
else:
guildicon = guild.icon_url
findbots = sum(1 for member in guild.members if member.bot)
findusers = sum(1 for member in guild.members if not member.bot)
webhook = Webhook(self.config.guildleavewebhook, is_async=True)
embed = dhooks.Embed(description=f'I\'ve left {guild.name}...', color=5810826, timestamp=True)
embed.set_author(name=f'{guild.name}', url='https://discordapp.com/oauth2/authorize?client_id=460383314973556756&scope=bot&permissions=469888118', icon_url=guildicon)
embed.set_thumbnail(url=guildicon)
embed.add_field(name='Info', value=f'New guild count: **{len(self.bot.guilds)}**\nOwner: **{guild.owner}**\nUsers/Bot Ratio: **{findusers}/{findbots}**')
await webhook.modify(name=guild.name, avatar=guildicon)
await webhook.execute(embeds=embed)
await webhook.close()
The full error:
Traceback (most recent call last):
File "C:\Users\Paws\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 225, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Paws\Desktop\Pawbot\cogs\events.py", line 84, in on_guild_join
await webhook.modify(name=guild.name, avatar=guildicon)
File "C:\Users\Paws\AppData\Local\Programs\Python\Python37-32\lib\site-packages\dhooks\client.py", line 153, in modify
payload['avatar'] = self.bytes_to_base64_data(avatar)
AttributeError: 'Webhook' object has no attribute 'bytes_to_base64_data'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0497DAF0>
Trying to run dhooks on Python 3.5.2 gives the following error:
File "/home/allianceserver/venv/auth/lib/python3.5/site-packages/dhooks/client.py", line 5, in <module>
from typing import Union, List, Optional, Coroutine
ImportError: cannot import name 'Coroutine'
After some research incl. this post on stackoverflow it appears to be the case that the class Coroutine
was not part of earlier versions of Python 3.5. There also does not seam to be a fix available other than upgrading to a newer Python version.
It does works with never versions of 3.5 though, e.g. I can confirm this for 3.5.7.
Since Python 3.5.2 is the latest version that comes with the widely used Ubuntu 16.04. LTS I would suggest to update the version information accordingly. Either find out and test from witch minor version of 3.5 this app will work probably or just say you need at least 3.6 to run this app.
Traceback (most recent call last):
File "/home/python/web/lino/librenode/app.py", line 12, in <module>
from dashboard.setups import setups_bp
File "/home/python/web/lino/librenode/dashboard/setups.py", line 4, in <module>
from . import audit
File "/home/python/web/lino/librenode/dashboard/audit.py", line 3, in <module>
import dhooks
… everything normal until here
File "/usr/local/lib/python3.10/site-packages/dhooks/__init__.py", line 1, in <module>
from .client import Webhook
File "/usr/local/lib/python3.10/site-packages/dhooks/client.py", line 3, in <module>
import aiohttp
File "/usr/local/lib/python3.10/site-packages/aiohttp/__init__.py", line 6, in <module>
from .client import (
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 35, in <module>
from . import hdrs, http, payload
File "/usr/local/lib/python3.10/site-packages/aiohttp/http.py", line 7, in <module>
from .http_parser import (
File "/usr/local/lib/python3.10/site-packages/aiohttp/http_parser.py", line 15, in <module>
from .helpers import NO_EXTENSIONS, BaseTimerContext
File "/usr/local/lib/python3.10/site-packages/aiohttp/helpers.py", line 667, in <module>
class CeilTimeout(async_timeout.timeout):
TypeError: function() argument 'code' must be code, not str
A part of my code:
import dhooks
hook = Webhook('https://discord.com/api/webhooks/CENSORED-ID/CECENSORED-URL')
embed = dhooks.Embed(
description=text,
color=0x662FE8,
timestamp='now'
)
...
allow for multiple webhook urls so it sends the webhook to all of them
in discord.py, you can pass an aware datetime object when creating and embed. With dhooks, the code only checks for the string "now" which gets filled with an unaware datetime object. While using "now" does decrease complexity slightly for new users, it increases confusion by not being the same as discord.py. if I'm misunderstanding how to pass a datetime object as a timestamp arg for an embed, please let me know, as my code isn't run locally and using another timezone is confusing.
Hi, i've installed the package twice today and python says to me that ModuleNotFoundError: No module named 'dhooks'
, while it was working on my other computer... Can you help me ?
ur examples say
from discordWebhooks import Webhook
while readme says
from discord_hooks import Webhook
I tried both sudo pip install discordWebhooks and
pip install discord_hooks
yes I have tried cloning in and installing discordhooks.py but same error when i try to run a example No module named discordhooks (mac)
none seem to work can u help
Thx
Hi,
Can you add a license to this project? This project is under copyright right now because you haven't added a license that specifies otherwise. RalphORama (#6) suggested MIT, and it would work perfectly.
ImportError: cannot import name 'Webhook' from partially initialized module 'dhooks' (most likely due to a circular import)
i get this error when trying to install dhooks
C:\Users\Daniel>pip3 install dhooks
Collecting dhooks
Using cached dhooks-1.1.4.tar.gz (11 kB)
Processing c:\users\daniel\appdata\local\pip\cache\wheels\b6\9c\bd\6b99bc6ec9dab11f3756d31fb8506d3ecf07aea58b6201f539\aiohttp-3.6.3-py3-none-any.whl
Requirement already satisfied: requests in c:\users\daniel\appdata\local\programs\python\python39\lib\site-packages (from dhooks) (2.21.0)
Collecting attrs>=17.3.0
Using cached attrs-20.2.0-py2.py3-none-any.whl (48 kB)
Collecting multidict<5.0,>=4.5
Using cached multidict-4.7.6.tar.gz (50 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting async-timeout<4.0,>=3.0
Using cached async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Requirement already satisfied: chardet<4.0,>=2.0 in c:\users\daniel\appdata\local\programs\python\python39\lib\site-packages (from aiohttp->dhooks) (3.0.4)
Collecting yarl<1.6.0,>=1.0
Using cached yarl-1.5.1.tar.gz (173 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: certifi>=2017.4.17 in c:\users\daniel\appdata\local\programs\python\python39\lib\site-packages (from requests->dhooks) (2020.6.20)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\daniel\appdata\local\programs\python\python39\lib\site-packages (from requests->dhooks) (2.8)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\daniel\appdata\local\programs\python\python39\lib\site-packages (from requests->dhooks) (1.24.3)
Using legacy 'setup.py install' for dhooks, since package 'wheel' is not installed.
Building wheels for collected packages: multidict, yarl
Building wheel for multidict (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\daniel\appdata\local\programs\python\python39\python.exe' 'c:\users\daniel\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\Daniel\AppData\Local\Temp\tmpnwkwc_9j'
cwd: C:\Users\Daniel\AppData\Local\Temp\pip-install-gqsdvdmt\multidict
Complete output (46 lines):
**********************
* Accellerated build *
**********************
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\multidict
copying multidict\_abc.py -> build\lib.win-amd64-3.9\multidict
copying multidict\_compat.py -> build\lib.win-amd64-3.9\multidict
copying multidict\_multidict_base.py -> build\lib.win-amd64-3.9\multidict
copying multidict\_multidict_py.py -> build\lib.win-amd64-3.9\multidict
copying multidict\__init__.py -> build\lib.win-amd64-3.9\multidict
running egg_info
writing multidict.egg-info\PKG-INFO
writing dependency_links to multidict.egg-info\dependency_links.txt
writing top-level names to multidict.egg-info\top_level.txt
reading manifest file 'multidict.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files found matching 'multidict\_multidict.html'
warning: no previously-included files found matching 'multidict\*.so'
warning: no previously-included files found matching 'multidict\*.pyd'
warning: no previously-included files found matching 'multidict\*.pyd'
no previously-included directories found matching 'docs\_build'
writing manifest file 'multidict.egg-info\SOURCES.txt'
copying multidict\__init__.pyi -> build\lib.win-amd64-3.9\multidict
copying multidict\_multidict.c -> build\lib.win-amd64-3.9\multidict
copying multidict\py.typed -> build\lib.win-amd64-3.9\multidict
creating build\lib.win-amd64-3.9\multidict\_multilib
copying multidict\_multilib\defs.h -> build\lib.win-amd64-3.9\multidict\_multilib
copying multidict\_multilib\dict.h -> build\lib.win-amd64-3.9\multidict\_multilib
copying multidict\_multilib\istr.h -> build\lib.win-amd64-3.9\multidict\_multilib
copying multidict\_multilib\iter.h -> build\lib.win-amd64-3.9\multidict\_multilib
copying multidict\_multilib\pair_list.h -> build\lib.win-amd64-3.9\multidict\_multilib
copying multidict\_multilib\views.h -> build\lib.win-amd64-3.9\multidict\_multilib
running build_ext
building 'multidict._multidict' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\multidict
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\daniel\appdata\local\programs\python\python39\include -Ic:\users\daniel\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include /Tcmultidict/_multidict.c /Fobuild\temp.win-amd64-3.9\Release\multidict/_multidict.obj -O2
_multidict.c
c:\users\daniel\appdata\local\programs\python\python39\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for multidict
Building wheel for yarl (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\daniel\appdata\local\programs\python\python39\python.exe' 'c:\users\daniel\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\Daniel\AppData\Local\Temp\tmpz4y2ernk'
cwd: C:\Users\Daniel\AppData\Local\Temp\pip-install-gqsdvdmt\yarl
Complete output (41 lines):
**********************
* Accellerated build *
**********************
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\yarl
copying yarl\_quoting.py -> build\lib.win-amd64-3.9\yarl
copying yarl\_quoting_py.py -> build\lib.win-amd64-3.9\yarl
copying yarl\_url.py -> build\lib.win-amd64-3.9\yarl
copying yarl\__init__.py -> build\lib.win-amd64-3.9\yarl
running egg_info
writing yarl.egg-info\PKG-INFO
writing dependency_links to yarl.egg-info\dependency_links.txt
writing requirements to yarl.egg-info\requires.txt
writing top-level names to yarl.egg-info\top_level.txt
reading manifest file 'yarl.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.cache' found anywhere in distribution
warning: no previously-included files found matching 'yarl\*.html'
warning: no previously-included files found matching 'yarl\*.so'
warning: no previously-included files found matching 'yarl\*.pyd'
no previously-included directories found matching 'docs\_build'
writing manifest file 'yarl.egg-info\SOURCES.txt'
copying yarl\__init__.pyi -> build\lib.win-amd64-3.9\yarl
copying yarl\_quoting_c.c -> build\lib.win-amd64-3.9\yarl
copying yarl\_quoting_c.pyi -> build\lib.win-amd64-3.9\yarl
copying yarl\_quoting_c.pyx -> build\lib.win-amd64-3.9\yarl
copying yarl\py.typed -> build\lib.win-amd64-3.9\yarl
running build_ext
building 'yarl._quoting_c' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\yarl
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\daniel\appdata\local\programs\python\python39\include -Ic:\users\daniel\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include /Tcyarl/_quoting_c.c /Fobuild\temp.win-amd64-3.9\Release\yarl/_quoting_c.obj
_quoting_c.c
c:\users\daniel\appdata\local\programs\python\python39\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for yarl
Failed to build multidict yarl
ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly
C:\Users\Jonas\Documents\GitHub\Rose-Injector\components\source>main.py
Traceback (most recent call last):
File "C:\Users\SECRET\Documents\GitHub\Rose-Injector\components\source\main.py", line 5, in <module>
import rose_rat
File "C:\Users\SECRET\Documents\GitHub\Rose-Injector\components\source\rose.py", line 187, in <module>
cmdhandler = CommandHandler()
^^^^^^^^^^^^^^^^
File "C:\Users\SECRET\Documents\GitHub\Rose-Injector\components\source\rose.py", line 26, in __init__
self.webhook = _WebhookX().get_object()
^^^^^^^^^^^
File "C:\Users\SECRET\Documents\GitHub\Rose-Injector\components\source\__webhook.py", line 10, in __init__
self.webx.modify(name=cc.get_name(), avatar=requests.get(cc.get_avatar()).content)
File "C:\Users\SECRET\AppData\Local\Programs\Python\Python311\Lib\site-packages\dhooks\client.py", line 297, in modify
payload['avatar'] = bytes_to_base64_data(avatar)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SECRET\AppData\Local\Programs\Python\Python311\Lib\site-packages\dhooks\utils.py", line 53, in bytes_to_base64_data
mime = mime_type(data)
^^^^^^^^^^^^^^^
File "C:\Users\SECRET\AppData\Local\Programs\Python\Python311\Lib\site-packages\dhooks\utils.py", line 48, in mime_type
raise ValueError('Unsupported image type given.')
ValueError: Unsupported image type given.
That's the error I get.
My code is the following:
from dhooks import Embed, File, Webhook
from config import Config
import requests
import os
cc = Config()
class _WebhookX():
def __init__(self):
self.webx = Webhook(cc.get_webhook())
self.webx.modify(name=cc.get_name(), avatar=requests.get(cc.get_avatar()).content)
def get_object(self):
return self.webx
And the config file looks like this:
self.secr_eb_color = 'MTY3MTE2ODA='
self.secr_eb_footer = 'Um9zZS1JbmplY3RvciB8IE1hZGUgYnkgR3VtYm9icm90LCBJQ0V4RlMsIHN1ZWdkdSBhbmQgeHBpZXJyb3ogfCBodHRwczovL2dpdGh1Yi5jb20vRGFtYWdpbmdSb3NlL1Jvc2UtSW5qZWN0b3I='
self.secr_wh_avatar = 'aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL0RhbWFnaW5nUm9zZS9Sb3NlLUluamVjdG9yL21haW4vcmVhZG1lL1Jvc2UuanBlZw=='
self.secr_wh_name = 'Um9zZS1JbmplY3Rvcg=='
self.eb_color = int(base64.b64decode(self.secr_eb_color.encode('ascii')).decode('ascii'))
self.eb_footer = str(base64.b64decode(self.secr_eb_footer.encode('ascii')).decode('ascii'))
self.wh_avatar = str(base64.b64decode(self.secr_wh_avatar.encode('ascii')).decode('ascii'))
self.wh_name = str(base64.b64decode(self.secr_wh_name.encode('ascii')).decode('ascii'))
I poorly encoded it with base64 because some dude threatened me that he would skid all our tools and build malware into them. He has absolutely no knowledge of Python, so I tried to include base64 in it.
The reason because I'm creating this issue is, I cannot find anyone else having this problem.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.