File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -40,19 +40,18 @@ These are end-to-end examples in various programming languages.
4040<Accordion title = " Python SDK Example" >
4141``` python
4242import csv
43- import os
4443import sys
4544import time
4645
4746from flareio import FlareApiClient
4847
4948
50- api_client = FlareApiClient(
51- api_key = os.environ[" FLARE_API_KEY" ],
52- )
49+ api_client = FlareApiClient.from_env()
5350
5451domain_name: str = " scatterholt.com"
55- from_: str | None = None
52+
53+ # The cursor from which we are starting the current execution.
54+ last_from: str | None = None
5655
5756writer = csv.DictWriter(
5857 sys.stdout,
@@ -71,7 +70,7 @@ for resp in api_client.scroll(
7170 " type" : " domain" ,
7271 " fqdn" : " scatterholt.com" ,
7372 },
74- " from" : from_ ,
73+ " from" : last_from ,
7574 },
7675):
7776 # Print results
@@ -85,8 +84,13 @@ for resp in api_client.scroll(
8584 },
8685 )
8786
87+ # Save the cursor for the next execution
88+ last_from = resp.json().get(" next" ) or last_from
89+
8890 # Rate limiting.
8991 time.sleep(0.25 )
92+
93+ print (f " The next execution could resume using { last_from= } . " )
9094```
9195</Accordion >
9296
You can’t perform that action at this time.
0 commit comments