20 lines
602 B
Python
20 lines
602 B
Python
from pprint import pprint
|
|||
|
|
import csv
|
||
|
|
from localconfig import OFFICESFILE
|
||
|
|
|
||
|
|
class Offices():
|
||
|
|
def __init__(self):
|
||
|
|
'''
|
||
|
|
Get the country - office detail from disk
|
||
|
|
|
||
|
|
'''
|
||
|
|
self.offices = {}
|
||
|
|
with open(OFFICESFILE, newline="", encoding="utf-8") as f_in:
|
||
|
|
reader = csv.DictReader(f_in)
|
||
|
|
for row in reader:
|
||
|
|
self.offices[row['Country']] = row
|
||
|
|
|
||
|
|
def get_office_details(self, country):
|
||
|
|
if country in self.offices.keys():
|
||
|
|
return self.offices[country]
|
||
|
|
return {'Name': '?', 'PartyId':'?', 'City': '?'}
|