|
19 | 19 | __version__ = '1.0'
|
20 | 20 | __license__ = 'MIT'
|
21 | 21 |
|
22 |
| - |
23 |
| -TOKEN = '9d5ed6c6-9cba-448f-9e98-a1634c888bdc' #Token registreret til MWL RSC ID, og budnet til google login. |
24 |
| - |
| 22 | +from private_token import TOKEN |
25 | 23 |
|
26 | 24 | class Compound(object):
|
27 | 25 | """ A class for retrieving record details about a compound by CSID.
|
@@ -149,27 +147,27 @@ def loadextendedcompoundinfo(self):
|
149 | 147 | response = urllib2.urlopen(apiurl)
|
150 | 148 | tree = ET.parse(response)
|
151 | 149 | mf = tree.find('{http://www.chemspider.com/}MF')
|
152 |
| - self._mf = mf.text if mf is not None else None |
| 150 | + self._mf = mf.text.encode('utf-8') if mf is not None else None |
153 | 151 | smiles = tree.find('{http://www.chemspider.com/}SMILES')
|
154 |
| - self._smiles = smiles.text if smiles is not None else None |
| 152 | + self._smiles = smiles.text.encode('utf-8') if smiles is not None else None |
155 | 153 | inchi = tree.find('{http://www.chemspider.com/}InChI')
|
156 |
| - self._inchi = inchi.text if inchi is not None else None |
| 154 | + self._inchi = inchi.text.encode('utf-8') if inchi is not None else None |
157 | 155 | inchikey = tree.find('{http://www.chemspider.com/}InChIKey')
|
158 |
| - self._inchikey = inchikey.text if inchikey is not None else None |
| 156 | + self._inchikey = inchikey.text.encode('utf-8') if inchikey is not None else None |
159 | 157 | averagemass = tree.find('{http://www.chemspider.com/}AverageMass')
|
160 |
| - self._averagemass = float(averagemass.text) if averagemass is not None else None |
| 158 | + self._averagemass = float(averagemass.text.encode('utf-8')) if averagemass is not None else None |
161 | 159 | molecularweight = tree.find('{http://www.chemspider.com/}MolecularWeight')
|
162 |
| - self._molecularweight = float(molecularweight.text) if molecularweight is not None else None |
| 160 | + self._molecularweight = float(molecularweight.text.encode('utf-8')) if molecularweight is not None else None |
163 | 161 | monoisotopicmass = tree.find('{http://www.chemspider.com/}MonoisotopicMass')
|
164 |
| - self._monoisotopicmass = float(monoisotopicmass.text) if monoisotopicmass is not None else None |
| 162 | + self._monoisotopicmass = float(monoisotopicmass.text.encode('utf-8')) if monoisotopicmass is not None else None |
165 | 163 | nominalmass = tree.find('{http://www.chemspider.com/}NominalMass')
|
166 |
| - self._nominalmass = float(nominalmass.text) if nominalmass is not None else None |
| 164 | + self._nominalmass = float(nominalmass.text.encode('utf-8')) if nominalmass is not None else None |
167 | 165 | alogp = tree.find('{http://www.chemspider.com/}ALogP')
|
168 |
| - self._alogp = float(alogp.text) if alogp is not None else None |
| 166 | + self._alogp = float(alogp.text.encode('utf-8')) if alogp is not None else None |
169 | 167 | xlogp = tree.find('{http://www.chemspider.com/}XLogP')
|
170 |
| - self._xlogp = float(xlogp.text) if xlogp is not None else None |
| 168 | + self._xlogp = float(xlogp.text.encode('utf-8')) if xlogp is not None else None |
171 | 169 | commonname = tree.find('{http://www.chemspider.com/}CommonName')
|
172 |
| - self._commonname = commonname.text if commonname is not None else None |
| 170 | + self._commonname = commonname.text.encode('utf-8') if commonname is not None else None |
173 | 171 |
|
174 | 172 | @property
|
175 | 173 | def image(self):
|
|
0 commit comments