MangaDex.py icon indicating copy to clipboard operation
MangaDex.py copied to clipboard

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

Open MrSoupman opened this issue 2 years ago • 1 comments

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.

MrSoupman avatar Dec 21 '22 06:12 MrSoupman

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

sonarqubecloud[bot] avatar Jan 08 '23 07:01 sonarqubecloud[bot]