Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly handle missing trailing slash in api_url #68

Merged
merged 2 commits into from
Dec 9, 2016

Conversation

valgur
Copy link
Member

@valgur valgur commented Nov 21, 2016

No description provided.

@kr-stn
Copy link
Member

kr-stn commented Nov 21, 2016

Good catch. The method _url_trail_slash was removed in an earlier PR because it was broken.

However we seem to have overlooked that urljoin('https://scihub.copernicus.eu/apihub', 'search?format=...') returns 'https://scihub.copernicus.eu/search?format=...' instead of 'https://scihub.copernicus.eu/apihub/search?format=...'

@@ -122,7 +122,7 @@ class SentinelAPI(object):
def __init__(self, user, password, api_url='https://scihub.copernicus.eu/apihub/', max_rows=100):
self.session = requests.Session()
self.session.auth = (user, password)
self.api_url = api_url
self.api_url = api_url if api_url[-1] == '/' else api_url + '/'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use if api_url.endswith('/') here? Same same but cleaner?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that's a bit better. I'll change that.

@willemarcel willemarcel merged commit 5adbb59 into sentinelsat:master Dec 9, 2016
@valgur valgur deleted the fix-api-url-slash branch May 30, 2017 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants