-
Notifications
You must be signed in to change notification settings - Fork 12
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
Added User Class for getting user info (No modifying or auth requests) #21
base: master
Are you sure you want to change the base?
Conversation
Added a simple exception raiser that triggers when MyAnimeList temporarily blocks incoming requests when you exceed the bandwith limit.
Added User Class to get all the user info from a specific user by username. The code is a bit crammed but works well.
Hi mblastergamer, Thanks for taking the time to do this. Adding User info is a great idea and I'm ok moving forward on this. I'm quite busy lately, but I will review the code soon and see what else is needed (e.g. tests, documentation, and/or restructuring). |
Perfect, take your time, i'm just happy to help. |
Currently looking at the code. Just one thing I would like to ask. Do you think we should use CSS selectors instead? Example: user_image = self._page.find("div", {"class": "user-image"}).findChildren("img")
self._image_url = None if user_image == [] else user_image[0]["data-src"] is equivalent to user_image = self._page.select_one(".user-image > img")
self._image_url = user_image["data-src"] if user_image else None Reference: I'm experimenting on this branch: |
Sorry for the late response, I have been quite busy. Yes, I didn't think about that when I was making the original code and some lines are quite long when they can be easily shortened by using css selectors. This error comes from my bad practice of coding bs4 calls piece by piece trying to reach some element. |
It's all good. I'll get back to it when I have time. |
Been working on this for a few months, postponing it, but I think that it is now ready. I did a lot of testing with big accounts and everything seems to work as intended. The code is a bit crammed and I didn't add comments or an example in the README. I can add comments later if it's necessary.
It accommodates all the info in Lists and Dicts, and also parses dates to datetime objects. Maybe the date parsing code can be moved to the Base class, so it can be used in other parts of the api. Still, it is a static method, so it can be executed just by importing the User class.
In my testing, there wasn't a need for any artificial delay. I didn't get banned even after 610 pages (Tested with an account that has over 61000 friends).
If anything else is needed from my part feel free to let me know.