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

add blacklist file #21

Closed
wants to merge 1 commit into from
Closed

add blacklist file #21

wants to merge 1 commit into from

Conversation

flavien-hugs
Copy link
Owner

Add token to black list on logout.

@flavien-hugs flavien-hugs added the bug Something isn't working label Aug 11, 2024
@flavien-hugs flavien-hugs self-assigned this Aug 11, 2024
Copy link

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

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

Some food for thought. View full project report here.


async def add_blacklist_token(self, token: str) -> bool:
try:
with open(file=self._token_file, mode="a") as file:

Choose a reason for hiding this comment

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

Suggested change
with open(file=self._token_file, mode="a") as file:
with open(file=self._token_file, mode="a", encoding="utf_8") as file:

UnicodeEncodeError can occur if the text being written to the file contain characters not compatible with the OS's default text encoding because encoding is not set. More info.


async def is_token_blacklisted(self, token: str) -> bool:
try:
with open(file=self._token_file) as file:

Choose a reason for hiding this comment

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

UnicodeDecodeError can occur if the content of the file has characters incompatible with the OS's default encoding. Python uses the OS's default text encoding on the content because encoding is not set. More info.

Copy link

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

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

Some food for thought. View full project report here.


async def add_blacklist_token(self, token: str) -> bool:
try:
with open(file=self._token_file, mode="a") as file:

Choose a reason for hiding this comment

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

Suggested change
with open(file=self._token_file, mode="a") as file:
with open(file=self._token_file, mode="a", encoding="utf_8") as file:

UnicodeEncodeError can occur if the text being written to the file contain characters not compatible with the OS's default text encoding because encoding is not set. Read more.


async def is_token_blacklisted(self, token: str) -> bool:
try:
with open(file=self._token_file) as file:

Choose a reason for hiding this comment

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

UnicodeDecodeError can occur if the content of the file has characters incompatible with the OS's default encoding. Python uses the OS's default text encoding on the content because encoding is not set. More info.

Copy link

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

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

Worth considering. View full project report here.


async def add_blacklist_token(self, token: str) -> bool:
try:
with open(file=self._token_file, mode="a") as file:

Choose a reason for hiding this comment

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

Suggested change
with open(file=self._token_file, mode="a") as file:
with open(file=self._token_file, mode="a", encoding="utf_8") as file:

UnicodeEncodeError can occur if the text being written to the file contain characters not compatible with the OS's default text encoding because encoding is not set. More details.


async def is_token_blacklisted(self, token: str) -> bool:
try:
with open(file=self._token_file) as file:

Choose a reason for hiding this comment

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

UnicodeDecodeError can occur if the content of the file has characters incompatible with the OS's default encoding. Python uses the OS's default text encoding on the content because encoding is not set. Explained here.

Copy link

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

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

Some things to consider. View full project report here.


async def is_token_blacklisted(self, token: str) -> bool:
try:
with open(file=self._token_file, mode="r") as file:

Choose a reason for hiding this comment

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

UnicodeDecodeError can occur if the content of the file has characters incompatible with the OS's default encoding. Python uses the OS's default text encoding on the content because encoding is not set. Explained here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant