Last active
June 17, 2021 09:36
-
-
Save huseinzol05/9422a5019c10829e952f42196d27848b to your computer and use it in GitHub Desktop.
hotspot in mysejahtera
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
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 16, | |
| "id": "bottom-ceremony", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "import requests\n", | |
| "\n", | |
| "cookies = {}\n", | |
| "\n", | |
| "headers = {\n", | |
| " 'Host': 'mysejahtera.malaysia.gov.my',\n", | |
| " 'Accept': 'application/json',\n", | |
| " 'Connection': 'keep-alive',\n", | |
| " 'Content-Length': '77',\n", | |
| " 'Authorization': 'Basic N0ZFRkRCMTMtN0Q2MC00NEQxLUE5MTctM0',\n", | |
| " 'Content-Type': 'application/json',\n", | |
| " 'Accept-Language': 'en-MY;q=1, ms-MY;q=0.9',\n", | |
| " 'User-Agent': 'MySejahtera/1.0.36 (iPhone; iOS 14.6; Scale/2.00)',\n", | |
| "}\n", | |
| "\n", | |
| "params = (\n", | |
| " ('type', 'search'),\n", | |
| ")\n", | |
| "\n", | |
| "# replace with your own latlong", | |
| "\n", | |
| "data = '[{\"lat\":2.8799079000000001,\"lng\":101.6618294,\"classification\":\"LOW_RISK_NS\"}]'\n", | |
| "\n", | |
| "response = requests.post('https://mysejahtera.malaysia.gov.my/register/api/nearby/hotspots', headers=headers, params=params, cookies=cookies, data=data)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 17, | |
| "id": "particular-village", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "{'hotSpots': [],\n", | |
| " 'zoneType': 'RED',\n", | |
| " 'messages': {'ms_MY': 'Hai {name}, terdapat 15 kes COVID-19 dalam lingkungan radius 1km dari lokasi ini yang dilaporkan dalam masa 14 hari yang lepas.',\n", | |
| " 'en_US': 'Hi {name}, there have been 15 reported case(s) of COVID-19 within a 1km radius from your searched location in the last 14 days.'},\n", | |
| " 'note': None}" | |
| ] | |
| }, | |
| "execution_count": 17, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "response.json()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 21, | |
| "id": "vital-chapel", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "{'zoneType': True,\n", | |
| " 'zoneColorCode': '#FF0000',\n", | |
| " 'message': {'ms_MY': \"Lokasi ini terletak di dalam <b style='color:#FF0000'>Zon Merah</b>\",\n", | |
| " 'en_US': \"This location is within the <b style='color:#FF0000'>Red Zone</b>\"}}" | |
| ] | |
| }, | |
| "execution_count": 21, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "import requests\n", | |
| "\n", | |
| "cookies = {}\n", | |
| "\n", | |
| "headers = {\n", | |
| " 'Accept-Language': 'en-MY;q=1, ms-MY;q=0.9',\n", | |
| " 'User-Agent': 'MySejahtera/1.0.36 (iPhone; iOS 14.6; Scale/2.00)',\n", | |
| " 'Content-Type': 'application/json',\n", | |
| " 'Accept': 'application/json',\n", | |
| " 'Authorization': 'Basic N0ZFRkRCMTMtN0Q2MC00NEQxLUE5MTctM0',\n", | |
| " 'Host': 'mysejahtera.malaysia.gov.my',\n", | |
| " 'Content-Length': '84',\n", | |
| " 'Connection': 'keep-alive',\n", | |
| "}\n", | |
| "\n", | |
| "# replace with your own latlong", | |
| "\n", | |
| "data = '[{\"lat\":2.9213179999999999,\"lng\":101.65593490000001,\"classification\":\"LOW_RISK_NS\"}]'\n", | |
| "\n", | |
| "response = requests.post('https://mysejahtera.malaysia.gov.my/register/api/zone', headers=headers, cookies=cookies, data=data)\n", | |
| "response.json()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "id": "coupled-injury", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python 3", | |
| "language": "python", | |
| "name": "python3" | |
| }, | |
| "language_info": { | |
| "codemirror_mode": { | |
| "name": "ipython", | |
| "version": 3 | |
| }, | |
| "file_extension": ".py", | |
| "mimetype": "text/x-python", | |
| "name": "python", | |
| "nbconvert_exporter": "python", | |
| "pygments_lexer": "ipython3", | |
| "version": "3.7.7" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 5 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment