Program InetUtilsGEOs_MAP_BOX4_Geoloc_API; //#sign 2:04 Max: MAXBOX10: 04/10/2019 12:24:42 PM //TODO: Save the chart map to webserver_file, #locs:999 //ref--> https://developers.google.com/chart/image/docs/gallery/googleometer_chart Const URLGoogleAPICode32= 'https://chart.apis.google.com/chart?chs=%dx%d&cht=gom&chd=t:%d&chl=mX4Score'+ '&chtt=%s&chts=FF0040,%d,c'; URLGoogleAPICode4='http://chart.apis.google.com/chart?cht=bhs&chd=t:86,68,62,59,55,51&chs=400x300&chxl=0:|0 wins|25 wins|50 wins|75 wins|100 wins|1:|Rickoos|Reefer|Dragon|maXbox|Aliboy|pb&chxt=x,y'; //" URLGeoLocAPI_csv= 'http://ip-api.com/csv/'; URLGeoLocAPI_json= 'http://ip-api.com/json/%s'; procedure GetQrCodeInet3(Wid,Heig,valu,size: Word;C_Level, apath:string; const title:string); var pngStream: TMemoryStream; begin //encodedURL:= Format(URLGoogleAPICode4,[]); pngStream:= TMemoryStream.create; HttpGet(Format(URLGoogleAPICode32,[wid,heig,valu,title,size]), pngStream); //WinInet with TLinearBitmap.Create do try pngStream.Position:= 0; LoadFromStream2(pngStream,'PNG'); //LoadFromFile(apath); SaveToFile(apath); OpenDoc(apath); finally Dispose; Free; pngStream.Free; end; end; function GetGeoloc(ipadr: string): string; var ipStream: TStringStream; begin //encodedURL:= Format(URLGoogleAPICode4,[]); ipStream:= TStringStream.create(''); try HttpGet(Format(URLGeoLocAPI_json,[ipadr]), ipStream); //WinInet ipStream.Seek(0,0); result:= 'GEO_LocReport: '+UTF8ToString(ipStream.ReadString(ipStream.Size)); finally ipStream.Free; end; end; function InetDownloadmX4(const URL: String; Dest:TStream; const Setts:TNetUtilsSettings; Callback: TInetDownloadCallback): Boolean; var InetHandle,URLHandle: HInternet; begin InetHandle:= InternetOpen(PChar(Setts.UserAgent),INTERNET_OPEN_TYPE_PRECONFIG, PChar(Setts.ProxyURL), 'NIL', 0); try URLHandle:= InternetOpenURL2(InetHandle,PChar(URL),Nil,0, INTERNET_FLAG_NO_UI or Setts.OpenURLFlags,0); try Result:= False; if IsResponseStatusOK(URLHandle) then begin InetBufferedReadFrom(URLHandle, Dest, Setts, Callback); Result:= True; end; finally InternetCloseHandle(URLHandle); end; finally InternetCloseHandle(InetHandle); end; end; function DownloadFile(SourceFile, DestFile: string): Boolean; begin //TCIPStatus //TBindStatus //TUrlZoneReg of URLMon try Result:= UrlDownloadToFile(Nil,PChar(SourceFile),PChar(DestFile),0,Nil)= 0; except Result:= False; end; end; //TODO:#1 Returns ChartCode direct of the last modification of the given File begin //@main //Writeln(datetimetostr(FileTimeGMT(exepath+'maxbox4.exe'))); //call of the script with a chart graphic on return //------------------------------------------- // ex.: 600*400 chartsize, 75=level, 60=titlesize, maXbox4=title //GetQrCodeInet3(600,400,75,60,'Q',ExePath+'mX4QRChart2map471.png','maXbox4'); sr:= getDNS; writeln('DNS: '+sr) writeln(GetGeoloc('')) //writeln(getIPConfigAll) End. Doc Ref: https://developers.google.com/chart/image/docs/gallery/pie_charts google.com but not Google's IP address, 216.58.223.14. When you chts [Optional] - Colors and font size for the chtt parameter. The title color, in RRGGBB hexadecimal format. Default color is black. Font size of the title, in points. [Optional] Alignment of the title. Choose one of the following case-sensitive string values: "l" (left), "c" (centered) "r" (right). Default is "c". http://open.mapquestapi.com/nominatim/ https://github.com/ProgerXP/D7X/tree/master/Units The following example demonstrates a simple search request for "Westminster Abbey" using Nominatim. Only three parameters are being requested: format - Output format being called. [html/json/xml] json_callback - Callback function used to display the results below. q - Query string being searched. The JavaScript code which sends the request and displays the result can be viewed here. https://www.google.com/finance?q=NYSE:BABA&ei=nAocVPjFL4nP8Aau6IHwBg from flask import Flask from flask import request import requests app = Flask(__name__) def get_country(ip_address): try: response = requests.get("http://ip-api.com/json/{}".format(ip_address)) js = response.json() country = js['countryCode'] return country except Exception as e: return "Unknown" @app.route("/") def home(): ip_address = request.remote_addr country = get_country(ip_address) # number of countries where the largest number of speakers are French # data from http://download.geonames.org/export/dump/countryInfo.txt if country in ('BL', 'MF', 'TF', 'BF', 'BI', 'BJ', 'CD', 'CF', 'CG', 'CI', 'DJ', 'FR', 'GA', 'GF', 'GN', 'GP', 'MC', 'MG', 'ML', 'MQ', 'NC'): return "Bonjour" return "Hello" if __name__ == "__main__": app.run() { "query": "46.127.118.41", "status": "success", "continent": "Europe", "continentCode": "EU", "country": "Switzerland", "countryCode": "CH", "region": "BE", "regionName": "Bern", "city": "Bern", "district": "", "zip": "3013", "lat": 46.9458, "lon": 7.4481, "timezone": "Europe/Zurich", "currency": "CHF", "isp": "UPC Schweiz GmbH", "org": "UPC Schweiz GmbH", "as": "AS6830 Liberty Global B.V.", "asname": "LGI-UPC", "mobile": false, "proxy": false } There is a strong demand for content similar to yours from our users. Hence, we would like to partner with you to bring your course to our users. ----app_template_loaded_code----