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

Update _Store_Token for api auth changes, and add several MDList functions #8

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

MrSoupman
Copy link

Auth changes

MangaDex updated their /auth/ endpoint (in 5.8.0 I believe?). This broke the wrapper's login function as the user would technically be logged in, but would receive 401 errors for any user get functions. (The docs don't reflect this yet and is still on version 5.7.5 as of writing, but digging through the mangadex discord I found all that needed to be done was add "Bearer" before the auth token in the Authorization header for requests).

MangaDexPy.MDList

Represents a MangaDex MDList
Yields:

  • id str
    The UUID of the MDList
  • name str
    The name of the MDList
  • visibility str
    Whether the list is public or private
  • titles Array[str, ...]
    A list of UUIDs of each manga added to this MDList.
  • creator str
    The UUID of the user the created the MDList.

MangaDexPy.MangaDex

get_MDList()
Gets a specified MDList from MangaDex
Note that it is only possible to get lists that belong to the user you are logged in as, or if the list is marked as 'public'. Otherwise a 404 not found error will occur.
Returns: A MDList object
Raises: NoContentError if there is no list with the given UUID, or if the currently logged in user does not have access to view that list. APIError for any other generic error.
Arguments: uuid of the MDList

get_MDList_feed()
Gets the feed of the specified MDList
Returns: Array[Chapter, ...]
Raises: NoResultsError for empty MDLists
Arguments:

  • uuid of the MDList to get feed for.
  • limit: How many Chapters to retrieve. Each multiple of 100 will make a new request to the API.
  • params: Custom dictionary of parameters to pass to the search utility

get_user_MDList()
Gets the currently logged user's MDLists, or a specified user's created MDLists.
As a note, the API docs state that private lists will only be included if you are logged in. Otherwise, only the public lists will be available.
Returns: Array[MDList, ...]
Raises: NoResultsError for empty MDLists or NotLoggedInError if an issue occurs while authenticating.
Arguments:

  • uuid of the user to get MDLists from.
  • limit: How many MDLists to retrieve. Each multiple of 100 will make a new request to the API.

get_user_followed_MDList()
Gets the currently logged user's followed MDLists
You must be logged in to use this call.
Returns: Array[MDList, ...]
Raises: NoResultsError when no objects were found
Arguments: limit: How many MDLists to retrieve. Each multiple of 100 will make a new request to the API.

is_following_MDList()
Returns whether the currently logged user is following a specified MDList
You must be logged in to use this call.
Returns: bool
Raises: NotLoggedInError if user is not logged in
Arguments:

  • uuid of the MDList to check

Some other notes

One known issue while testing this:

  • There exists manga which do not have a "translatedLanguage" attribute, which causes an error to be raised.
  • One instance of this is https://mangadex.org/title/d1c0d3f9-f359-467c-8474-0b2ea8e06f3d/bocchi-sensei-teach-me-mangadex

Lists are listed on the API as CustomList, but it seems this is an older name.
This should be most, if not all the GET methods related to CustomLists.
This is my first time make a PR on github, I apologize if there's some oddity while making this.

MangaDex updated their /auth/ endpoint (in 5.8.0 I believe?). This broke the wrapper's login function as the user would technically be logged in, but would receive 401 errors for any user get functions.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

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