add geo-info for telemetry

This commit is contained in:
idea4good 2020-12-25 00:48:27 +08:00
parent efd8ae9e32
commit ca849654b2
1 changed files with 30 additions and 1 deletions

View File

@ -12,4 +12,33 @@ curl --include --request POST --header "Content-Type: application/json" --data-b
\"project_info\" :\"$1\",
\"time\" :\"$build_time\",
\"weight\" :1
}]" $url
}]" $url > /dev/null
#--------------- Geo info ----------------#
curl ipinfo.io > ip_info.txt # get IP info
grep city ip_info.txt > ip_city.txt # filter city
sed -i 's/"city"://g' ip_city.txt #remove property name
sed -i 's/"//g' ip_city.txt #remove double quotes
city=`sed 's/,//g' ip_city.txt` #remove comma
grep country ip_info.txt > ip_country.txt # filter country
sed -i 's/"country"://g' ip_country.txt #remove property name
sed -i 's/"//g' ip_country.txt #remove double quotes
country=`sed 's/,//g' ip_country.txt` #remove comma
grep org ip_info.txt > ip_org.txt # filter org
sed -i 's/"org"://g' ip_org.txt #remove property name
sed -i 's/"//g' ip_org.txt #remove double quotes
org=`sed 's/,//g' ip_org.txt` #remove comma
url="https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/d6c4145f-2fdc-4071-94f7-fbdb090914d4/rows?key=pQ7GFsXkAqJij4v%2BadZDoth6HB%2BmjZbAn0d%2B%2BtlWnE3jpm1s0lGKoFeFV7aF1QQ7PKOYGpQYYCkS0tjzxTgbLQ%3D%3D"
curl --include --request POST --header "Content-Type: application/json" --data-binary "[{
\"county\" :\"$country\",
\"city\" :\"$city\",
\"organization\" :\"$org\",
\"weight\" :1
}]" $url > /dev/null
rm ip_*