Skip to content

Commit

Permalink
Merge 3ae71d4 into 58e45f6
Browse files Browse the repository at this point in the history
  • Loading branch information
mcs07 committed Mar 28, 2017
2 parents 58e45f6 + 3ae71d4 commit 507c7cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chemspipy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __init__(self, security_token=None, user_agent=None, api_url=None):
:param string api_url: (Optional) Alternative API server.
"""
log.debug('Initializing ChemSpider')
self.api_url = api_url if api_url else 'http://www.chemspider.com'
self.api_url = api_url if api_url else 'https://www.chemspider.com'
self.http = requests.session()
self.http.headers['User-Agent'] = user_agent if user_agent else 'ChemSpiPy/%s Python/%s ' % (__version__, sys.version.split()[0])
self.security_token = security_token
Expand Down
2 changes: 1 addition & 1 deletion chemspipy/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def url(self):
:rtype: string
"""
return 'http://www.chemspider.com/FilesHandler.ashx?type=blob&disp=1&id=%s' % self.spectrum_id
return 'https://www.chemspider.com/FilesHandler.ashx?type=blob&disp=1&id=%s' % self.spectrum_id

@memoized_property
def data(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ def test_no_original_url():
def test_url():
"""Test retrieving spectrum url."""
s = cs.get_spectrum(3558)
eq_(s.url, 'http://www.chemspider.com/FilesHandler.ashx?type=blob&disp=1&id=3558')
eq_(s.url, 'https://www.chemspider.com/FilesHandler.ashx?type=blob&disp=1&id=3558')
for compound in cs.search('Aspirin'):
for spectrum in compound.spectra:
ok_(spectrum.url.startswith('http://www.chemspider.com/FilesHandler.ashx?type=blob&disp=1&id='))
ok_(spectrum.url.startswith('https://www.chemspider.com/FilesHandler.ashx?type=blob&disp=1&id='))


def test_data():
Expand Down

0 comments on commit 507c7cd

Please sign in to comment.