Mercurial > p > roundup > code
comparison roundup/rest.py @ 5937:5d0873a4de4a
fix rate limit headers - were ints/floats need to be strings
Running under gunicorn rest requests were crashing. Not all of the
values for the rate limit headers were strings. Some were
numbers. This caused the header generation for wsgi to fail. Now the
values are all strings.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 20 Oct 2019 20:56:56 -0400 |
| parents | 3ca3bfe6de16 |
| children | 25a813415d59 |
comparison
equal
deleted
inserted
replaced
| 5936:ed5c19fca083 | 5937:5d0873a4de4a |
|---|---|
| 1776 for header, value in limitStatus.items(): | 1776 for header, value in limitStatus.items(): |
| 1777 self.client.setHeader(header, value) | 1777 self.client.setHeader(header, value) |
| 1778 # User exceeded limits: tell humans how long to wait | 1778 # User exceeded limits: tell humans how long to wait |
| 1779 # Headers above will do the right thing for api | 1779 # Headers above will do the right thing for api |
| 1780 # aware clients. | 1780 # aware clients. |
| 1781 msg=_("Api rate limits exceeded. Please wait: %d seconds.")%limitStatus['Retry-After'] | 1781 msg=_("Api rate limits exceeded. Please wait: %s seconds.")%limitStatus['Retry-After'] |
| 1782 output = self.error_obj(429, msg, source="ApiRateLimiter") | 1782 output = self.error_obj(429, msg, source="ApiRateLimiter") |
| 1783 else: | 1783 else: |
| 1784 for header,value in limitStatus.items(): | 1784 for header,value in limitStatus.items(): |
| 1785 # Retry-After will be 0 because | 1785 # Retry-After will be 0 because |
| 1786 # user still has quota available. | 1786 # user still has quota available. |
