There are a variety of reasons for swollen ankles and feet including high blood pressure, cardiovascular problems, circulation problem, kidney problem and something putting pressure on a major vein (the Inferior vena cava) and cellulitis, although both legs at once are less common.
Transient swelling could be related to prolonged immobility causing calf muscles failing to pump fluid back into the circulation. Other causes include varicose veins, side-effects of some drugs and being overweight.
A mild diuretic would be the first action, together with compression hosiery.
Keep your legs elevated at a high angle when you can to encourage drainage and if you have a sedentary job ensure that you get up and move around every hour.
Avoid caffeine drinks, but do continue to drink water. Reduce your salt intake too.
You mention that your doctor gave you keflex, I hope he also listened to your chest and ran some blood tests in the meantime?
Are both legs equally swollen?
Any shortness of breath?
Are you passing normal amounts of urine?
Symptoms of shortness of breath on exertion and swollen ankles needs a proper cardio-respiratory examination and you should return to your family doctor or go to ER for a proper assessment. Certainly I would be suggesting a diuretic to help move the fluid and depending on the results of your physical examination then I would consider blood tests and additional scan such as ECHO.
Having an operation can cause complications and new symptoms should not be ignored.