Skip to content

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.

1 participant