File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -154,19 +154,10 @@ def _get_crumb(self, retries):
154
154
params = self .params , headers = self .headers )
155
155
out = str (self ._sanitize_response (response ))
156
156
# Matches: {"crumb":"AlphaNumeric"}
157
- regex = re .search (r'"crumb" ?: ?"([A-Za-z0-9.\\]{11,})"' , out )
158
-
159
- if regex is not None :
160
- crumbs = regex .groups ()
161
- crumb = re .sub (r'\\' , '' , crumbs [0 ])
162
- return crumb
163
- elif retries > 0 :
164
- # It is possible we hit a 401 with frequent requests. Cool-off:
165
- time .sleep (2 )
166
- retries -= 1
167
- return self ._get_crumb (retries )
168
- else :
169
- raise OSError ("Unable to retrieve Yahoo breadcrumb, exiting." )
157
+ rpat = '"CrumbStore":{"crumb":"([^"]+)"}'
158
+
159
+ crumb = re .findall (rpat , out )[0 ]
160
+ return crumb .encode ('ascii' ).decode ('unicode-escape' )
170
161
171
162
172
163
def _adjust_prices (hist_data , price_list = None ):
You can’t perform that action at this time.
0 commit comments