1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "requests": [
10 {
11 "name": "httpbin echo",
12 "url": "https://httpbin.org/get",
13 "params": { "hello": "world" },
14 },
15 {
16 "name": "httpbin POST JSON",
17 "method": "POST",
18 "url": "https://httpbin.org/post",
19 "json": {
20 "task": "demo",
21 "items": [
22 1,
23 2,
24 3,
25 ],
26 },
27 },
28 {
29 "name": "JSONPlaceholder post",
30 "url": "https://jsonplaceholder.typicode.com/posts/1",
31 },
32 {
33 "name": "GitHub repo",
34 "url": "https://api.github.com/repos/apify/crawlee",
35 "headers": { "Accept": "application/vnd.github+json" },
36 },
37 {
38 "name": "npm package",
39 "url": "https://registry.npmjs.org/express/latest",
40 },
41 {
42 "name": "Open-Meteo weather",
43 "url": "https://api.open-meteo.com/v1/forecast",
44 "params": {
45 "latitude": 52.52,
46 "longitude": 13.41,
47 "current": "temperature_2m",
48 },
49 },
50 {
51 "name": "Cat fact",
52 "url": "https://catfact.ninja/fact",
53 },
54 {
55 "name": "Dog image",
56 "url": "https://dog.ceo/api/breeds/image/random",
57 },
58 {
59 "name": "US ZIP code",
60 "url": "https://api.zippopotam.us/us/90210",
61 },
62 {
63 "name": "CoinGecko ping",
64 "url": "https://api.coingecko.com/api/v3/ping",
65 },
66 {
67 "name": "Frankfurter FX",
68 "url": "https://api.frankfurter.app/latest",
69 "params": {
70 "from": "USD",
71 "to": "EUR",
72 },
73 },
74 ],
75 "maxResults": 50,
76}
77
78
79run = client.actor("henrycrawl/http-request-api").call(run_input=run_input)
80
81
82print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
83for item in client.dataset(run.default_dataset_id).iterate_items():
84 print(item)
85
86