Closed checkm4te8 closed 2 years ago
Also, for some reason, it's just EduDate that's broken.
# bot.py
import os
from prettytable import PrettyTable
import base64
import discord
from discord.ext import commands
from dotenv import load_dotenv
from edupage_api import Edupage, EduTeacher, EduStudent, EduDate
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
If I remove EduDate, it works, but otherwise it doesn't.
One last thing, it used to work before but it just suddenly stopped after an Update of some sort I assume.
Yes, it is caused because of an update (0.9.7
).
Hello, I've switched to using datetime
instead of EduDate, as it is more common in python and date code is hard to write, so it is better if we use code someone else (someone smarter) has written.
If you used this code in the old version:
from edupage_api import Edupage, EduTeacher, EduStudent, EduDate
# ...
today = EduDate.today()
timetable = edupage.get_timetable(today)
# ...
you can now write the same code using datetime
:
from edupage_api import Edupage, EduTeacher, EduStudent
from datetime import datetime
# ...
today = datetime.now()
timetable = edupage.get_timetable(today)
# ...
If you have more concrete questions or a problems updating your old code (or encounter any bugs), please post a snippet, I can help you update it.
You can always view the "documentation" (types and method names, return types, class structure...) here: yesdaddyfuck.me/edupage-api
Note: This is not the only change in the library, you may need to update some other code too, depends on what you are using.
Were you able to update your code? Can I close this issue?
Closing issue due to inactivity.
Hi, I made a Discord bot with edupage_api but when I launch it, I get the error below, any ideas?
WARNING: You are using pip version 21.2.4; however, version 22.0.2 is available. You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command. Traceback (most recent call last): File "/home/container/bot.py", line 11, in
from edupage_api import Edupage, EduTeacher, EduStudent, EduDate
ImportError: cannot import name 'EduDate' from 'edupage_api' (/home/container/.local/lib/python3.10/site-packages/edupage_api/init.py)