Skip to content

Conversation

@walro
Copy link
Contributor

@walro walro commented Oct 16, 2017

Same as twingly/twingly-search-api-ruby#69.

Re-record fixtures to get fixtures without published time bugs.

Same as twingly/twingly-search-api-ruby#69.

Re-record fixtures to get fixtures without published time bugs.
],
"recorded_with": "betamax/0.8.0"
} No newline at end of file
{"http_interactions": [{"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Connection": "keep-alive", "Accept-Encoding": "gzip, deflate", "Accept": "*/*", "User-Agent": "Twingly Search Python Client/2.1.0"}, "method": "GET", "uri": "https://api.twingly.com/blog/search/api/v3/search?q=something&apiKey=wrong"}, "response": {"body": {"string": "<?xml version=\"1.0\" encoding=\"utf-8\"?><error code=\"40101\"><message>Unauthorized</message></error>", "encoding": "utf-8"}, "headers": {"Content-Length": "97", "Expires": "-1", "Server": "nginx", "Connection": "keep-alive", "Pragma": "no-cache", "Cache-Control": "no-cache", "Date": "Mon, 16 Oct 2017 08:54:09 GMT", "Content-Type": "application/xml; charset=utf-8"}, "status": {"message": "Unauthorized", "code": 401}, "url": "https://api.twingly.com/blog/search/api/v3/search?q=something&apiKey=wrong"}, "recorded_at": "2017-10-16T08:54:09"}], "recorded_with": "betamax/0.5.1"} No newline at end of file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm I should probably update my betamax so get nicer output :) cough #11

Copy link
Contributor Author

Choose a reason for hiding this comment

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

didn't matter, maybe it's Windows vs macOS thing.

… with newer betamax to get nicer output
q.start_time = self.datetime_with_timezone(datetime(2012, 12, 28, 9, 1, 22), "UTC")
query_string = q.build_query_string()
self.assertEqual(query_string, "spotify start-date:2012-12-28T09:01:22Z")
self.assertEqual(query_string, "spotify start-date:2012-12-28 09:01:22")
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be "spotify start-date:\"2012-12-28 09:01:22\"" (surrounded by quotes) now that the timestamp contains a space?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think, the request sent will actually include %20 (or +). Also take a look at what we had before: 4e4ef2b

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But yeah, I see our docs includes quoting, but I don't think it's necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, investigated some more. Seems like you are right. We probably have this bug in most of clients. Nice catch.

Copy link
Member

Choose a reason for hiding this comment

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

Adding a T between the date and the time parts works as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding a T between the date and the time parts works as well.

Yes, seems to be working. I am thinking we should possibly update our developer site to prefer this over quoting. Should be easier for customers and also easier for us when reading logs.

walro added 2 commits October 16, 2017 14:36
With great search and replace comes great responsibility.
@walro walro merged commit 865595f into master Oct 18, 2017
@walro walro deleted the do-not-include-tz-info branch October 18, 2017 13:49
walro added a commit that referenced this pull request Oct 20, 2017
Do not include timezone information in queries (#38)
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.

3 participants