Using a food processor with a coarse grating disc, grate the potatoes and onions. If you don't have a food processor, grate potatoes and onions on the large holes of a box grater.
To squeeze the excess liquid out of the potatoes, place the shredded potatoes and onions in a colander set in a bowl, and press down with the back of a big spoon. Discard the extra liquid. You can also spread them on a kitchen towel and twist towel to wring out as much liquid as possible.
Transfer potato mixture to a large bowl and stir in eggs, flour, salt, and pepper and mix until combined.
In a large skillet over medium heat, pour in oil until it reaches 1/4 - ½ inch ( ½ - 1cm) up the sides of the pan. Once the oil is hot (a drop of batter placed in the pan should sizzle), use a heaping tablespoon to drop the batter into the pan, working in batches. Use moderate heat when cooking the latkes, otherwise, they will turn dark quickly. Use a spatula to flatten the latkes into discs. Cook until golden brown, about 4 minutes per side. Transfer the latkes to a paper towel-lined plate. Repeat with the remaining batter. Serve immediately, with sour cream or yogurt, if desired.