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

JSON downloading isn't checking for rate limits #4

Open
joewiz opened this issue Jun 10, 2016 · 0 comments
Open

JSON downloading isn't checking for rate limits #4

joewiz opened this issue Jun 10, 2016 · 0 comments

Comments

@joewiz
Copy link
Member

joewiz commented Jun 10, 2016

To reproduce the error I just got: clear the import directory, start http://localhost:8080/exist/apps/twitter/jobs/download-recent-twitter-json.xq. Errors out after 180 requests, with the following error:

err:XPTY0004 expression to the left of a lookup operator needs to be a sequence of maps or arrays [at line 145, column 44, source: /db/apps/twitter/modules/twitter-downloader.xqm] In function: twitter-dl:download-last-json(xs:unsignedLong?)

Submitting a subsequent user-timeline() request in eXide returns the following response indicating why the download failed:

<hc:response xmlns:hc="http://expath.org/ns/http-client" status="429" message="Too Many Requests" spent-millis="241">
    <hc:header name="content-length" value="56"/>
    <hc:header name="content-type" value="application/json;charset=utf-8"/>
    <hc:header name="date" value="Fri, 10 Jun 2016 14:29:59 GMT"/>
    <hc:header name="server" value="tsa_b"/>
    <hc:header name="strict-transport-security" value="max-age=631138519"/>
    <hc:header name="x-connection-hash" value="e5771896d2cb604eaf24fdb8620977ae"/>
    <hc:header name="x-rate-limit-limit" value="180"/>
    <hc:header name="x-rate-limit-remaining" value="0"/>
    <hc:header name="x-rate-limit-reset" value="1465569208"/>
    <hc:header name="x-response-time" value="7"/>
    <hc:body media-type="application/json"/>
</hc:response>

I wonder too if it might be more efficient to request more than 1 tweet at a time (as I understand the code), and store the json at the same time we store the xml, since now we have to submit duplicate requests.

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

No branches or pull requests

1 participant