Skip to content

Allow for Multiple tokens#1

Merged
mathsman5133 merged 13 commits into
mathsman5133:masterfrom
JustinBacher:master
Apr 19, 2019
Merged

Allow for Multiple tokens#1
mathsman5133 merged 13 commits into
mathsman5133:masterfrom
JustinBacher:master

Conversation

@JustinBacher

Copy link
Copy Markdown
Contributor

Suggest allowing multiple tokens as well as no tokens to be passed such that the client automatically looks up the tokens.

I attempted to make as many notes as possible, although I have not tested this code yet so be on the lookout for typos and such but this should be a good start toward this capability. Any questions lemme know!

Fix to allow either str or list for tokens and if str then make it a list. Also allow None and it will auto get them from API
Yet another fix to the tokens checks

@mathsman5133 mathsman5133 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - I will change the token name/description to something more interesting too lol. couple of little comments...

Comment thread coc/http.py Outdated
Comment thread coc/http.py Outdated
else:
self._tokens = tokens

self._tokens = [token['key'] for token in current_tokens]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats this do? should it be inside the if not tokens: block?

@JustinBacher JustinBacher Apr 18, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically if tokens is none then we get them from the email/pass. Otherwise it uses the given tokens. I do think we should filter the tokens we get from the developer portal to only ones that are for the IP.

@JustinBacher JustinBacher Apr 18, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh just read that again, yes it should be oops my bad

Comment thread coc/http.py Outdated
I believe this was a typo but that should fix it
This is only in draft as I'm running into a conundrum. Should we manage the token ammounts? Should we let the user decide how many tokens to use? Should we allow tokens to be named by the user so multiple Clients can use their own token naming schema?
@JustinBacher

Copy link
Copy Markdown
Contributor Author

Those changes should fix everything but the last one has a comment with some questions. Please refer to it as I want to make sure we're on the same page

Comment thread coc/dataclasses.py
clan = data.get('clan', {})
if clan and ('tag' in clan.keys()):
clan = data.get('clan')
if clan and 'tag' in clan):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. thought it would raise some attribute error since default is none but works nicely.
Got an extra close bracket on line 502

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops haha, will fix that and some more later, I think that tracking by token name may be the best, This would allow for multiple clients at once on different IPs

@mathsman5133 mathsman5133 merged commit ef152ae into mathsman5133:master Apr 19, 2019
majordoobie pushed a commit that referenced this pull request Oct 20, 2022
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.

2 participants