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

"ValueError: Invalid webhook URL provided" #37

Open
sboulah opened this issue Jul 27, 2020 · 16 comments
Open

"ValueError: Invalid webhook URL provided" #37

sboulah opened this issue Jul 27, 2020 · 16 comments

Comments

@sboulah
Copy link

sboulah commented Jul 27, 2020

Discord appears to have changed webhooks and now whenever I try to use it I get a ValueError message, this only happens with the newly generated webhooks, all the old ones seem to work fine.

My Sample Code:
Code

Error message:
ErrorMessage

@mischievousdev
Copy link
Contributor

What is your dhooks version?

@sboulah
Copy link
Author

sboulah commented Jul 27, 2020

1.1.4

@mischievousdev
Copy link
Contributor

Update dhooks, latest fix will resolve the issue

@sboulah
Copy link
Author

sboulah commented Jul 27, 2020

updated using pip and says that v1.1.4 is the latest

@mischievousdev
Copy link
Contributor

Sorry my bad that's the latest version

@Aloqeely
Copy link
Contributor

I've just tried with 2 webhooks (old and new) and both worked as expected, what discord client are you using? for ex: regular discord or canary etc

@Aloqeely
Copy link
Contributor

Aloqeely commented Jul 27, 2020

actually, can you run this code and return the output?

import re
hook_url = "webhook url"

def hook_test1():
    URL_REGEX = r'^(?:https?://)?((canary|ptb)\.)?discord\.com/api/webhooks/(?P<id>[0-9]+)/(?P<token>[A-Za-z0-9\.\-\_]+)/?$'
    print(bool(re.match(URL_REGEX, hook_url)))

def hook_test2():
    URL_REGEX = r'^(?:https?://)?((canary|ptb)\.)?discord(app)?\.com/api/webhooks/(?P<id>[0-9]+)/(?P<token>[A-Za-z0-9\.\-\_]+)/?$'
    print(bool(re.match(URL_REGEX, hook_url)))

hook_test1()
hook_test2()

@sboulah
Copy link
Author

sboulah commented Jul 27, 2020

Regular discord on my pc, I noticed that the new webhooks seem to have a different layout than the old ones

@sboulah
Copy link
Author

sboulah commented Jul 27, 2020

Still getting the same error:

Traceback (most recent call last): File "c:/Users/samib/Documents/Python/Projects/newwebhooks.py", line 3, in <module> hook = Webhook('https://discordapp.com/api/webhooks/736933475734519898/R5_mA80O-Yrm0Xds_TBHjfpYrp5xIKc5M0369KoC3dNMqX-24OPkrKjltCqmiW6YuNIC') File "C:\Users\samib\AppData\Local\Programs\Python\Python38-32\lib\site-packages\dhooks\client.py", line 144, in __init__ self._parse_or_format_url() File "C:\Users\samib\AppData\Local\Programs\Python\Python38-32\lib\site-packages\dhooks\client.py", line 482, in _parse_or_format_url raise ValueError('Invalid webhook URL provided.') ValueError: Invalid webhook URL provided. PS C:\Users\samib\Documents\Python>

@Aloqeely
Copy link
Contributor

oh i see, that webhook is still using the discordapp domain (you forgot to blur it 😅), i'll PR a fix but in the meantime replace discordapp.com with discord.com from your url

@sboulah
Copy link
Author

sboulah commented Jul 27, 2020

Thanks, its alright this is on a test account and server

@DeJMan
Copy link

DeJMan commented Jul 28, 2020

I changed it to discord.com instead and it still didn't work

I changed it to discord.com instead and it still didn't work

@Aloqeely
Copy link
Contributor

are you using the latest version of dhooks (1.1.4)?

@DeJMan
Copy link

DeJMan commented Jul 29, 2020

Ah I thought I was.

Apparently, heroku was using cached dependencies of an older dhooks library even though locally I was using the latest one.

Bit of tinkering and I got it to clear cache and update. It works fine now, thanks.

@S0V3T
Copy link

S0V3T commented Jul 29, 2020

Have same issue

@Aloqeely
Copy link
Contributor

Aloqeely commented Aug 5, 2020

Have same issue

Read through this and you'll hopefully find a fix for your issue, The cause of this issue has been fixed but @kyb3r needs to push it to pypi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants