Skip to content

Commit

Permalink
Update for GOV site upgrade - Bug 13496 (#616)
Browse files Browse the repository at this point in the history
* Trap errors when GOV site not working properly - Bug 13496

Trap error when using urlopen on GOV site.

* Change to HTTPS

Fix bad URL and change to HTTPS. This solves for non-Macs after the GOV website update.
  • Loading branch information
GaryGriffin authored Nov 11, 2024
1 parent 181628a commit 52be0da
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions GetGOV/getgov.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from gramps.gen.datehandler import parser
from gramps.gen.config import config
from gramps.gen.display.place import displayer as _pd

from gramps.gui.dialog import WarningDialog
#------------------------------------------------------------------------
#
# Internationalisation
Expand Down Expand Up @@ -367,8 +367,12 @@ def __get_places(self, obj):
self.dbstate.db.commit_place(place, trans)

def __get_types(self):
type_url = 'http://gov.genealogy.net/types.owl/'
response = urlopen(type_url)
type_url = 'https://gov.genealogy.net/types.owl'
try:
response = urlopen(type_url)
except:
WarningDialog(_('GetGOV: access to GOV gazetteer OWL files failed. Returning blank location'))
return
data = response.read()
dom = parseString(data)
for group in dom.getElementsByTagName('owl:Class') :
Expand All @@ -392,16 +396,18 @@ def __get_types(self):
self.type_dic[type_number,type_lang] = type_text

def __get_place(self, gov_id, type_dic, preferred_lang):
gov_url = 'http://gov.genealogy.net/semanticWeb/about/' + quote(gov_id)

response = urlopen(gov_url)
gov_url = 'https://gov.genealogy.net/semanticWeb/about/' + quote(gov_id)
place = Place()
place.gramps_id = gov_id
try:
response = urlopen(gov_url)
except:
return place, []
data = response.read()

dom = parseString(data)
top = dom.getElementsByTagName('gov:GovObject')

place = Place()
place.gramps_id = gov_id
if not len(top) :
return place, []

Expand Down

0 comments on commit 52be0da

Please sign in to comment.