Νίκος writes: > > because it raises KeyError exceptions to this: > > > > city = gi.time_zone_by_addr( os.environ.get('HTTP_CF_CONNECTING_IP', > > 'REMOTE_ADDR') ) or "�γν���η Π�λη" > > > > host = socket.gethostbyaddr( os.environ.get('HTTP_CF_CONNECTING_IP', > > 'REMOTE_ADDR') )[0] or "�γν���η Π�οέλε���η" > > > > But that doesnt seem to also work. > > I want to use the get method because i know if it doesnt does detect a > > dictionary key item than default back what we give it. > > Can you please tell me why my alternative fails to work although i'am > using the .get method to default to something?
I lost connection. Absent HTTP_CF_CONNECTING_IP in os.environ, these reduce to city = ( gi.time_zone_by_addr('REMOTE_ADDR') or "�γν���η Π�λη" ) host = ( socket.gethostbyaddr('REMOTE_ADDR')[0] or "�γν���η Π�οέλε���η" ) so maybe 'REMOTE_ADDR' is not meant to be the actual argument in those calls. Earlier versions tried to get 'REMOTE_ADDR' from os.environ, I think. Try Nobody's piecemeal approach, maybe.
-- https://mail.python.org/mailman/listinfo/python-list