Changeset 4372 for trunk/kSUBGROUPSMAG.py
- Timestamp:
- Mar 18, 2020 5:25:22 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kSUBGROUPSMAG.py
r4365 r4372 16 16 ########### SVN repository information ################### 17 17 from __future__ import division, print_function 18 import requests19 18 try: 20 19 import HTMLParser as HTML … … 22 21 import html.parser as HTML # Python 3 23 22 import GSASIIspc as G2spc 23 import GSASIIIO as G2IO 24 24 import GSASIIpath 25 25 GSASIIpath.SetBinaryPath() … … 140 140 for i,k in zip(('x','y','z'),kvec[3*j-3:3*j]): 141 141 postdict['km%d%s'%(j,i)] = k 142 try: 143 r = requests.get(submagSite,params=postdict) 144 except: #ConnectionError? 145 page = '' 146 print('connection error - not on internet') 142 page = G2IO.postURL(submagSite,postdict) 143 if not page: 144 print('connection error - not on internet?') 147 145 return None,None 148 if r.status_code == 200: 149 print('request OK') 150 page = r.text 151 page = page.replace('<font style= "text-decoration: overline;">','<font>-') 152 else: 153 page = '' 154 print('request failed. Reason=',r.reason) 155 return None,None 156 r.close() 157 146 page = page.replace('<font style= "text-decoration: overline;">','<font>-') 158 147 p = TableParser() 159 148 p.feed(page) … … 213 202 for i,k in zip(('x','y','z'),kvec[3*j-3:3*j]): 214 203 postdict['knm%d%s'%(j,i)] = k 215 try: 216 r = requests.get(submagSite,params=postdict) 217 except: #ConnectionError? 218 page = '' 219 print('connection error - not on internet') 220 return None 221 if r.status_code == 200: 222 print('request OK') 223 page = r.text 224 page = page.replace('<font style= "text-decoration: overline;">','<font>-') 225 else: 226 page = '' 227 print('request failed. Reason=',r.reason) 228 return None 229 r.close() 230 204 if not page: 205 print('connection error - not on internet?') 206 return None,None 207 page = page.replace('<font style= "text-decoration: overline;">','<font>-') 231 208 p = TableParser() 232 209 p.feed(page)
Note: See TracChangeset
for help on using the changeset viewer.