I am iterating through a list users
of approximately 1000 entries, like so:
def wikidata_user_lookup(id_str):
q = f'''
SELECT ?item ?itemLabel ?kind ?kindLabel
WHERE
{{
?item p:P2002 ?twitter .
?item wdt:P31 ?kind .
?twitter pq:P6552 "{id_str}" .
SERVICE wikibase:label {{ bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }}
}}
'''
sparql.setQuery(q)
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
results_df = pd.io.json.json_normalize(results['results']['bindings'])
return results_df
for user in users:
res = wikidata_user_lookup(user)
So I am submitting ~1000 queries, one after another. As far as I can tell, I'm not running multiple queries in parallel, so shouldn't this be allowed? I am getting HTTPError: HTTP Error 429: Too Many Requests
. What's the correct way to deal with this situation?