/usr/share/doc/python3-cloudflare/examples
NameSizeModeActions
example_always_use_https.py19890644editdlrm
example_are_zones_ipv6.py18760644editdlrm
example_are_zones_ipv6_simple.py5580644editdlrm
example_certificates.py26730644editdlrm
example_create_zone_and_populate.py39350644editdlrm
example_custom_hostnames.py22800644editdlrm
example_delete_zone_entry.py20340644editdlrm
example_dnssec_settings.py14590644editdlrm
example_dns_export.py13660644editdlrm
example_graphql.py23280644editdlrm
example_graphql.sh9810644editdlrm
example_ips.py7630644editdlrm
example_list_api_from_web.py4540644editdlrm
example_page_rules.sh4400644editdlrm
example_paging_thru_zones.py12040644editdlrm
example_paging_thru_zones.sh7800644editdlrm
example_proxied.py33880644editdlrm
example_settings.py18270644editdlrm
example_update_dynamic_dns.py42730644editdlrm
example_user.py55120644editdlrm
example_with_usage.py6770644editdlrm
example_zones.py24360644editdlrm
example_zone_search.sh4200644editdlrm
__init__.py00644editdlrm
Edit: /usr/share/doc/python3-cloudflare/examples/example_graphql.sh (981B)
: # # Show usage of GraphQL - see https://developers.cloudflare.com/analytics/graphql-api for all info # # pass one argument - the zone ZONEID=`cli4 name="$1" /zones | jq -r '.[].id'` if [ "${ZONEID}" = "" ] then echo "$1: zone not found" 1>&2 exit 1 fi # Just query the last 24 hours DATE_BEFORE=`date -u +%Y-%m-%dT%H:%M:%SZ` DATE_AFTER=`date -u -v -24H +%Y-%m-%dT%H:%M:%SZ` # build the GraphQL query - this is just a simple example QUERY=' query { viewer { zones(filter: {zoneTag: "'${ZONEID}'"} ) { httpRequests1hGroups(limit:100, orderBy:[datetime_ASC], filter:{datetime_gt:"'${DATE_AFTER}'", datetime_lt:"'${DATE_BEFORE}'"}) { dimensions { datetime } sum { bytes } } } } } ' # this not only does the query; but also drills down into the results to print the final data cli4 --post query="${QUERY}" /graphql | jq -cr '.data.viewer.zones[]|.httpRequests1hGroups[]|.dimensions.datetime,.sum.bytes' | paste - -