Last active
November 9, 2016 16:19
-
-
Save abargnesi/e76f33b7b781febb97d16377d8eca1ff to your computer and use it in GitHub Desktop.
Induce and log instagram connection issues using curl and jq.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
API_URL="https://api.instagram.com/v1/tags/foodporn/media/recent" | |
TOKEN="PUT YOUR TOKEN HERE" | |
request_next_url() { | |
URL="$1" | |
#http2 connections seem to be immune to connection issues. | |
#echo $(curl --http2 --verbose "$URL" 2>> trace-http2.log | jq .pagination.next_url | tr -d '"') | |
echo $(curl --http1.1 --verbose "$URL" 2>> trace-http.log | jq .pagination.next_url | tr -d '"') | |
} | |
export -f request_next_url | |
NEXT_URL=$(request_next_url "$API_URL?access_token=$TOKEN") | |
echo "R: $NEXT_URL" | |
while [ -n "$NEXT_URL" ]; do | |
NEXT_URL=$(request_next_url "$NEXT_URL") | |
echo "R: $NEXT_URL" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following shows a
200 OK
response where response body transfer was closed.