Skip to content

Instantly share code, notes, and snippets.

@tvorogme
Created October 22, 2023 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvorogme/6839002510010e275e0339c0847a12ed to your computer and use it in GitHub Desktop.
Save tvorogme/6839002510010e275e0339c0847a12ed to your computer and use it in GitHub Desktop.
import requests
from time import sleep
def f(x):
return """{
transactions(
address_friendly: "Ef8gQpp7pKD9GzBrcr3ju9faPjEWHPerhZ4tFpSiDoDUINxn",
order_by: "lt"
lt_gt: """ + '"' + str(x) + '"' + """
page_size: 150
page: 0
) {
gen_utime
hash
lt
}
}"""
endpoint = 'https://dton.io/graphql/'
cur = 0
total = []
while True:
response = requests.post(endpoint, json={'query': f(cur)})
try:
data = response.json()['data']['transactions']
except Exception as e:
sleep(1)
continue
print(f"Got: {len(data)}")
cur = int(max([i['lt'] for i in data]))
if len(data) == 0:
break
else:
total.extend(data)
sleep(1)
print(len(total))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment