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

Use OrderedDict for query_options to retain dict ordering (issue for … #116 #1

Merged
merged 2 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/onedrivesdk/request_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
except ImportError:
from urlparse import urlparse, parse_qsl, urlunparse
from urllib import urlencode

from collections import OrderedDict

class RequestBase(object):

Expand All @@ -48,7 +48,7 @@ def __init__(self, request_url, client, options):
self._client = client
self._request_url = request_url
self._headers = {}
self._query_options = {}
self._query_options = OrderedDict()
self.content_type = None

if (options):
Expand All @@ -58,7 +58,7 @@ def __init__(self, request_url, client, options):

query_list = [
pair for pair in options if isinstance(pair, QueryOption)]
self._query_options = {pair.key: pair.value for pair in query_list}
self._query_options = OrderedDict((pair.key, pair.value) for pair in query_list)

@property
def request_url(self):
Expand All @@ -68,7 +68,7 @@ def request_url(self):
str: The request URL
"""
url_parts = list(urlparse(self._request_url))
query_dict = dict(parse_qsl(url_parts[4]))
query_dict = OrderedDict(parse_qsl(url_parts[4]))
self._query_options.update(query_dict)
url_parts[4] = urlencode(self._query_options)
return urlunparse(url_parts)
Expand Down Expand Up @@ -172,7 +172,7 @@ def download_item(self, path):

Returns:
:class:`HttpResponse<onedrivesdk.http_response.HttpResponse>`:
The response to the request
The response to the request
"""
self._client.auth_provider.authenticate_request(self)

Expand Down
2 changes: 1 addition & 1 deletion src/onedrivesdk/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.8
1.1.9