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

fix: allow calls with channels along with api key authentication #527

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Xpshnik
Copy link

@Xpshnik Xpshnik commented Jul 3, 2024

I would like to suggest a fix associated with channels usage in API calls.

Since client id and client secret authentication has become legacy, channels are now not unique to the calls made with this method of authentication. The usage of channels without client id is even mentioned in the following lines of code that are part of the current library version:

if channel:
if not re.match("^[a-zA-Z0-9._-]*$", channel):
raise ValueError("The channel argument must be an ASCII "
"alphanumeric string. The period (.), underscore (_)"
"and hyphen (-) characters are allowed. If used without "
"client_id, it must be 0-999.")

However, in the method _generate_auth_url the channel parameter is added to the authentication URL only if client id and secret were provided. Thus it is currently impossible to apply channels to calls authenticated with just API key using this library, they are simply not part of the final authentication URL as long as client id and secret weren't provided:

if accepts_clientid and self.client_id and self.client_secret:
if self.channel:
params.append(("channel", self.channel))
params.append(("client", self.client_id))

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

Successfully merging this pull request may close these issues.

None yet

1 participant