Skip to content

Commit

Permalink
Added the address Expansion feature with this release
Browse files Browse the repository at this point in the history
  • Loading branch information
selva221724 committed Apr 11, 2022
1 parent 5a130e4 commit 8c9c3a0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pypostalwin/src/pypostalwin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from subprocess import Popen, PIPE

import subprocess

def stringToJSON(string):
if not string in ['{}']:
Expand Down Expand Up @@ -57,6 +57,16 @@ def runParser(self, address):
result += line
return outputStripper(result)

def expandTheAddress(self,address):
address = removeSpeacialChars(address)
out = subprocess.Popen(['C:\Workbench\libpostal\src\libpostal.exe',
address, '--json'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)

stdout, stderr = out.communicate()
return eval(stdout.decode("utf-8"))['expansions']

def terminateParser(self):
self.process.stdin.close()
self.process.terminate()
Expand Down

0 comments on commit 8c9c3a0

Please sign in to comment.