Git Product home page Git Product logo

python-red-alert's Introduction

Description

API Class to get data about rockets flying from Gaza strip to Israel. the API use's the official public API provided by "Pikud ha-oref" in Israel.

Mivtza halot-ha-shahar Update

On August 5th 2022 the Islamic Jihad opened an attack on Israel sending hundreds of rockets per day targeting Israeli civilians. The API was updated to suport the latest locations, cities and districts.

Google API currently disabled because it requires API key, if you still need the API apply your own Google key to make it work.

Features

  • Get red-alerts in real-time from "Pikud ha-oref" public API
  • Fetch location data from alerts codes (coordinates, city names, time to run for shelters)
  • Generate random coordinates within a city for visualization of a flying rocket
  • Count number of alerts currently there is

Example response from the API:

{
  "id": "133042653750000000",
  "cat": "1",
  "title": "ירי רקטות וטילים",
  "data": [
    "מטווח ניר עם",
    "גבים, מכללת ספיר",
    "שדרות, איבים, ניר עם"
  ],
  "desc": "היכנסו למרחב המוגן ושהו בו 10 דקות",
  "timestamp": 1659791786.927377,
  "cities_labels": [
    {
      "label": "מטווח ניר עם",
      "value": "20C0B212CB4A85AB765743BB2A748106",
      "areaid": 26,
      "areaname": "עוטף עזה",
      "label_he": "מטווח ניר עם",
      "migun_time": 15,
      "city_data": {
        "label": "מטווח ניר עם I אזור עוטף עזה",
        "rashut": "",
        "value": "0",
        "areaid": 26,
        "mixname": "מטווח ניר עם I אזור עוטף עזה | עוטף עזה",
        "color": "O"
      }
    },
    {
      "label": "גבים, מכללת ספיר",
      "value": "89679BD023B4DE666AD79E1470E20D83",
      "areaid": 26,
      "areaname": "עוטף עזה",
      "label_he": "גבים, מכללת ספיר",
      "migun_time": 15,
      "city_data": {
        "label": "גבים, מכללת ספיר I אזור עוטף עזה",
        "rashut": "מועצה אזורית: שער הנגב",
        "value": "0",
        "areaid": 26,
        "mixname": "גבים, מכללת ספיר I אזור עוטף עזה | עוטף עזה",
        "color": "O"
      }
    },
    {
      "label": "שדרות, איבים, ניר עם",
      "value": "C5FD35F7510C4E1D535EDD8DE05A7961",
      "areaid": 26,
      "areaname": "עוטף עזה",
      "label_he": "שדרות, איבים, ניר עם",
      "migun_time": 15,
      "city_data": {
        "label": "ניר עם I אזור עוטף עזה",
        "rashut": "מועצה אזורית: שער הנגב",
        "value": "0",
        "areaid": 26,
        "mixname": "ניר עם I אזור עוטף עזה | עוטף עזה",
        "color": "O"
      }
    },
    {
      "label": "שדרות, איבים, ניר עם",
      "value": "3202695F8E2D49A4FCA18B95A88C0CA4",
      "areaid": 26,
      "areaname": "עוטף עזה",
      "label_he": "שדרות, איבים, ניר עם",
      "migun_time": 15,
      "city_data": {
        "label": "שדרות I אזור עוטף עזה",
        "rashut": "",
        "value": "0",
        "areaid": 26,
        "mixname": "שדרות I אזור עוטף עזה | עוטף עזה",
        "color": "O"
      }
    },
    {
      "label": "שדרות, איבים, ניר עם",
      "value": "F53EA9083272E342ADE0146DA1C25E59",
      "areaid": 26,
      "areaname": "עוטף עזה",
      "label_he": "שדרות, איבים, ניר עם",
      "migun_time": 15,
      "city_data": {
        "label": "איבים I אזור עוטף עזה",
        "rashut": "מועצה אזורית: שער הנגב",
        "value": "0",
        "areaid": 26,
        "mixname": "איבים I אזור עוטף עזה | עוטף עזה",
        "color": "O"
      }
    }
  ],
  "time_to_run": 15
}

FAQ

Q) Why is this even helpful?

  • The Class I made is helpful for developers and makers as one Who are willing to develop platforms / apps based on Israeli "Pikud ha-oref" system. The class provides the necessary functions and tools to get the latest information About the Israeli missiles status and when Israel is under attack.

Q) Can't the enemy use it against Israel?

  • No. All the information in the Class is public and available, All I did is to organize it at one place for easy access. I also scraped and organized the cities names with their area codes for easy reading.

Q) Can I take the code and make a product of my own using your Class?

  • Absolutely. The code and everything inside the repository is open-sourced. The Code is under MIT license - please make sure to understand the meaning. The Code provided AS IS WITHOUT ANY WARRANTY.

Q) How can I visualize how much time the rocket have till it will hit the city?

  • Use the milliseconds calculated from how much time left for people to run to shelters, Then visualize using that seconds of long the rocket has to fly till it will hit the city.

Q) Is it possible to predict or to know where exactly the missile will land?

  • No, at least not for the developers. the military may have such capabilities. The prediction is not possible due to many parameters such as: Where the rocket came from, How much fuel is inside the rocket, at what speed is the rocket flying, Directions of the rocket and weather conditions - something which make it impossible for any non-military individual, even with technology such as machine learning and prediction algorithms.

Requirements

  • Python requests library
$ pip3 install requests

python-red-alert's People

Contributors

overjump1 avatar samuelcardillo avatar zontex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-red-alert's Issues

How to run a test server

When I multiply the Main file and put alert link to perform "tests" I get the following error

Traceback (Most Recent Call Last):
File "C: \ User's \ User \ Desktop \ Python-Red-Mold-Master \ Src \ Main1.py", LINE 151, in
Main ()
File "C: \ Use \ User \ Desktop \ Python-Red-Hert-Master \ Src \ Main1.py", LINE 119, in Main
Red_alerts = Alert.get_red_Alerts ()
File "C: \ Use \ User \ Desktop \ Python-Rred-Bald-Master \ Src \ Main1.py", LINE 93, in Get_RED_ALRTS
Alerts = R.Content.decode ("UTF-8"). Replace ("\ n", "). Replace (" \ r ",")
Unicodedecodeperror: 'Utf-8

The format of the data I introduced in the JSON file is the data that appears in the Readme.D file.
You can explain why I get this error only when I replace the Home Front Command's link to the link with which I do "tests"

How to access alerts from the past?

Hi thanks for this great repo! Star from me :)

I see the python-red-alert.src.main() will log current alerts happening, but I want to get all the alerts that have happened in the last 4 months (and save them to a file).

Is that possible to do?

Can't run the code

Hey, I was trying to use your python code to make a Red Alert discord bot, but the code won't run and I don't understand the error.

Error:

Traceback (most recent call last):
  File "D:\Amit\RedAlert\DiscordBot\run.py", line 154, in <module>
    main()
  File "D:\Amit\RedAlert\DiscordBot\run.py", line 122, in main
    alert = RedAlert()
  File "D:\Amit\RedAlert\DiscordBot\run.py", line 19, in __init__
    self.locations = self.get_locations_list()
  File "D:\Amit\RedAlert\DiscordBot\run.py", line 84, in get_locations_list
    for line in csv:
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\encodings\cp1255.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 1: character maps to <undefined>

Process finished with exit code 1

If you can help me it would be awesome!

The code cannot be activated

Traceback (most recent call last):
File "c:\Users\User\Desktop\python-red-alert-master\src\main.py", line 150, in
main()
File "c:\Users\User\Desktop\python-red-alert-master\src\main.py", line 108, in main
alert = RedAlert()
File "c:\Users\User\Desktop\python-red-alert-master\src\main.py", line 15, in init
self.locations = self.get_locations_list()
File "c:\Users\User\Desktop\python-red-alert-master\src\main.py", line 83, in get_locations_list
f = open('targets.json')
FileNotFoundError: [Errno 2] No such file or directory: 'targets.json'

Node-Red example

Hi!
My coding skills are terrible, but I'm getting there, slowly. I was wondering if someone can help me make this API into a node in Node-Red, for use in my home automation system. Anyone out there use node-red?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.