{"action":"created","issue":{"url":"https://api.github.com/repos/murtaza52/faiz-static/issues/132","repository_url":"https://api.github.com/repos/murtaza52/faiz-static","labels_url":"https://api.github.com/repos/murtaza52/faiz-static/issues/132/labels{/name}","comments_url":"https://api.github.com/repos/murtaza52/faiz-static/issues/132/comments","events_url":"https://api.github.com/repos/murtaza52/faiz-static/issues/132/events","html_url":"https://github.com/murtaza52/faiz-static/issues/132","id":135054168,"number":132,"title":"Thali detail search on Telegram","user":{"login":"mustafamnr","id":16903293,"avatar_url":"https://avatars.githubusercontent.com/u/16903293?v=3","gravatar_id":"","url":"https://api.github.com/users/mustafamnr","html_url":"https://github.com/mustafamnr","followers_url":"https://api.github.com/users/mustafamnr/followers","following_url":"https://api.github.com/users/mustafamnr/following{/other_user}","gists_url":"https://api.github.com/users/mustafamnr/gists{/gist_id}","starred_url":"https://api.github.com/users/mustafamnr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mustafamnr/subscriptions","organizations_url":"https://api.github.com/users/mustafamnr/orgs","repos_url":"https://api.github.com/users/mustafamnr/repos","events_url":"https://api.github.com/users/mustafamnr/events{/privacy}","received_events_url":"https://api.github.com/users/mustafamnr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"murtraja","id":7806954,"avatar_url":"https://avatars.githubusercontent.com/u/7806954?v=3","gravatar_id":"","url":"https://api.github.com/users/murtraja","html_url":"https://github.com/murtraja","followers_url":"https://api.github.com/users/murtraja/followers","following_url":"https://api.github.com/users/murtraja/following{/other_user}","gists_url":"https://api.github.com/users/murtraja/gists{/gist_id}","starred_url":"https://api.github.com/users/murtraja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/murtraja/subscriptions","organizations_url":"https://api.github.com/users/murtraja/orgs","repos_url":"https://api.github.com/users/murtraja/repos","events_url":"https://api.github.com/users/murtraja/events{/privacy}","received_events_url":"https://api.github.com/users/murtraja/received_events","type":"User","site_admin":false},"assignees":[{"login":"murtraja","id":7806954,"avatar_url":"https://avatars.githubusercontent.com/u/7806954?v=3","gravatar_id":"","url":"https://api.github.com/users/murtraja","html_url":"https://github.com/murtraja","followers_url":"https://api.github.com/users/murtraja/followers","following_url":"https://api.github.com/users/murtraja/following{/other_user}","gists_url":"https://api.github.com/users/murtraja/gists{/gist_id}","starred_url":"https://api.github.com/users/murtraja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/murtraja/subscriptions","organizations_url":"https://api.github.com/users/murtraja/orgs","repos_url":"https://api.github.com/users/murtraja/repos","events_url":"https://api.github.com/users/murtraja/events{/privacy}","received_events_url":"https://api.github.com/users/murtraja/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-02-20T09:37:49Z","updated_at":"2016-08-29T13:16:02Z","closed_at":null,"body":""},"comment":{"url":"https://api.github.com/repos/murtaza52/faiz-static/issues/comments/243120504","html_url":"https://github.com/murtaza52/faiz-static/issues/132#issuecomment-243120504","issue_url":"https://api.github.com/repos/murtaza52/faiz-static/issues/132","id":243120504,"user":{"login":"murtraja","id":7806954,"avatar_url":"https://avatars.githubusercontent.com/u/7806954?v=3","gravatar_id":"","url":"https://api.github.com/users/murtraja","html_url":"https://github.com/murtraja","followers_url":"https://api.github.com/users/murtraja/followers","following_url":"https://api.github.com/users/murtraja/following{/other_user}","gists_url":"https://api.github.com/users/murtraja/gists{/gist_id}","starred_url":"https://api.github.com/users/murtraja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/murtraja/subscriptions","organizations_url":"https://api.github.com/users/murtraja/orgs","repos_url":"https://api.github.com/users/murtraja/repos","events_url":"https://api.github.com/users/murtraja/events{/privacy}","received_events_url":"https://api.github.com/users/murtraja/received_events","type":"User","site_admin":false},"created_at":"2016-08-29T13:16:02Z","updated_at":"2016-08-29T13:16:02Z","body":"please see the legends at the bottom first\r\n\r\n**work done so far:**\r\n\r\n1) bot @ PA <==> db @ SG\r\n initially @murtaza52 introduced me to telegram bots and provided me a demo google sheet link in which thali details were stored. my job was to read from the cloud and based on the query retrieve the particular information.\r\n\r\n1's implementation) used a free service by PA by setting a webhook at this domain for the bot, whenever a request was fired from telegram by the user, this bot crawled through the sheet and got the relevant information back to the user\r\n\r\n2) user <=/=> bot @ FS\r\nwe then shifted to MySQL and the sheets idea was altogether dropped and the bot was rendered useless - the new job was to set the webhook at hostinger so that when user fires a request, it should go to FS and the relevant information would be request from database and then furnished to the user who asked for it\r\n\r\n2's limitations) i learnt that webhook can only be set for those domains who support SSL or HTTPS. since hostinger doesn't support it (actually it does support in the paid account), this implementation was dropped.\r\n\r\n3) user <==> bot @ PA <=/=> db @ FS\r\nthen it occurred to me that why not host the bot on PA where HTTPS support is built in, and use it to communicate between the user and the database located at faizstudents.com. of course it will be slow because two web servers are involved but just by fraction of seconds.\r\n\r\n3's limitations) pythonanywhere.com does not support communication between those sites who don't have public api i.e. only some whitelisted sites can be accessed through it. so essentially i could not query the database from pythonanywhere.com to faizstudents.com due to this.\r\n\r\n4) user <==> telegram server <========> bot,db @ FS\r\ninstead of having a webhook, telegram also supports a manual method to get the user's request, but the problem is that we need to constantly check for it as opposed to the previous method where you are automatically informed.\r\n\r\n4's limitations) hostinger does not support a cron job on minute basis, it supports a larger time interval like hours or days. So if a user was to fire a request, on the worst case it would take an hour or so to process the request and get the reply, rendering the whole idea of \"fast response\" useless.\r\n\r\n5) user <==> bot @ PA <==> db @ SG <========= db @ FS\r\nthen another idea popped up which has close ties with  #162 . why not take the database backup using google sheets and then use it for telegram bot database (now pythonanywhere.com will be able to access the data through sheets because it has public API, refer 3rd point above) essentially killing two birds with one stone\r\n\r\n5's limitations) @yusuf4u52 suggested that backing up data on google sheets is a very inconvenient approach since in order to actually use that backup, SQL queries will have to be built first. the second reason is that this data will be a day old (assuming taking backup every day, we can take it every hour but the point remains), so now this time the accuracy of the data is compromised\r\n\r\n6) user <==> bot @ herokuapp.com <==> db @ FS\r\nMufaddal bhai Jamal recommended Heroku wherein https support was built in. i tried that and it worked since heroku apps are allowed to communicate with other servers - no such system as whitelisted sites. so currently i am using this approach to solve the problem\r\n\r\n**legends**\r\nPA = pythonanywhere.com\r\nFS = faizstudents.com\r\nSG = sheets.google.com\r\n<==>  connection possible\r\n<=/=> connection not possible\r\n<=======> slow or repeated update\r\n@ located at domain"}}
{"actor":{"display_login":"murtraja"}}