I have a large number (>1000) of polygons in a shapefile. I would like to measure their approximate length. The polygons are somehow elongated, so a quantity such as the length of longest line within a polygon, or the half of its perimeter, could be good approximations for the polygons' lengths. I am new to GIS. I can load the shapefile on Google Earth Pro for example, and manually measure these lengths. But this would be a very tedious and inaccurate work. I also have access to QGIS and Python.
In short: is there a way to obtain distances (in km) between the two farthest points in a polygon automatically, or the polygon's perimeter, given a large number of polygons in a shapefile?
Preferably using Python, QGIS or Google Earth Pro.
EDIT: Since my polygons are so elongated, I would be happy with approximating the length by half of the perimeter. This could actually be more accurate than the length of longest line within, because some polygons are also curvy.