Created
July 18, 2021 12:35
-
-
Save JoeGlines/b4b17c9e527e6dfb34e8bd58c84804aa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
;******************************************************* | |
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY | |
; Right now you can get a coupon code here: https://the-Automator.com/Learn | |
;************************************************************ | |
IniRead, API_Token ,Auth.ini,API, Token | |
;~ Endpoint:="http://api.openweathermap.org/data/2.5/weather" ; Review https://duckduckgo.com/api for documentation | |
Endpoint:="http://api.openweathermap.org/data/2.5/forecast/daily" ; Review https://duckduckgo.com/api for documentation | |
;~ QueryString:=QueryString_Builder({"zip":"75019,us","APPID":API_Token}) | |
;~ QueryString:=QueryString_Builder({"lat":"32.9915376","lon":"-96.9799073","APPID":API_Token}) | |
QueryString:=QueryString_Builder({"mode":"xml","cnt":"16","units":"imperial","id":"4683217","APPID":API_Token}) | |
;******API call************************ | |
HTTP := ComObjCreate("WinHttp.WinHttpRequest.5.1") ;Create COM Object | |
HTTP.Open("GET", Endpoint . QueryString) ;GET & POST are most frequent, Make sure you UPPERCASE | |
HTTP.Send() | |
Response_Data:= HTTP.ResponseText ;Save the text that is returned | |
MsgBox % Response_Data | |
QueryString_Builder(x){ | |
for a,b in x | |
String.=(A_Index=1?"?":"&") a "=" b | |
return String | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment