Skip to content

Commit 28ae9ef

Browse files
committed
Fix for FT redirect to unencoded URLs
1 parent 090e604 commit 28ae9ef

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/baseclient.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import random
1717
import select
1818
import urllib.request
19+
import urllib.parse
1920
from http import cookiejar
2021
from http.client import HTTPConnection, HTTPSConnection, HTTPException
2122

@@ -162,7 +163,8 @@ def urlopen(self, url, redirect=True, data=None, headers={}, cookies=[], **kwarg
162163
while 300 <= self.response.status < 400 and self.redirect_count >= 0:
163164

164165
self.redirect_count -= 1
165-
location = self.response.getheader('Location')
166+
location = str(self.response.getheader('Location'))
167+
location = location.replace(' ', '%20') # FT bug workaround - this should not be necessary
166168

167169
if location and redirect:
168170

src/generate_metainfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
cur_dir = os.getcwd()
1515

1616
addin_id = "com.financials.getinfo"
17-
addin_version = "3.6.2"
17+
addin_version = "3.6.3"
1818
addin_displayname = "Financial Market Extension"
1919
addin_publisher_link = "https://github.com/cmallwitz/Financials-Extension"
2020
addin_publisher_name = "The Publisher"

src/test_ft.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,13 @@ def test_DK_equity(self):
309309
self.assertEqual(str, type(s), 'test_DK_equity INDUSTRY {}'.format(s))
310310
self.assertEqual('Pharmaceuticals and Biotechnology', s, 'test_DK_equity INDUSTRY {}'.format(s))
311311

312+
def test_SE_equity(self):
313+
s = financials.getRealtime('ACRI A:STO', 'name', 'FT')
314+
self.assertEqual('Acrinova AB (publ)', s, 'test_SE_equity NAME {}'.format(s))
315+
316+
s = financials.getRealtime('SE0015660014', 'name', 'FT')
317+
self.assertEqual('Acrinova AB (publ)', s, 'test_SE_equity NAME {}'.format(s))
318+
312319
def test_TY_equity(self):
313320
s = financials.getRealtime('6503:TYO', 'OPEN', 'FT')
314321
self.assertEqual(float, type(s), 'test_TY_equity OPEN {}'.format(s))

0 commit comments

Comments
 (0)