Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…pu.go.id into publish
  • Loading branch information
ridwaanhall committed Mar 18, 2024
2 parents 920b471 + 4353d28 commit 6a86a82
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 22 deletions.
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
# this data from [KPU](https://pemilu2024.kpu.go.id/)

click [here](https://ridwaanhall.github.io/pemilu2024.kpu.go.id/) to see percentage of real count
[![wakatime](https://wakatime.com/badge/user/018b799e-de53-4f7a-bb65-edc2df9f26d8/project/018da7b7-99cb-467c-b130-86ce7afc934c.svg)](https://wakatime.com/badge/user/018b799e-de53-4f7a-bb65-edc2df9f26d8/project/018da7b7-99cb-467c-b130-86ce7afc934c)

```txt
REAL COUNT - Pemilu 2024 KPU
last update: 08 March 2024 17:00:15 WIB
Progress: 643,231 of 823,378 TPS (78.1210% done)
## click [https://pemilu2024.kpu.go.id/](https://ridwaanhall.github.io/pemilu2024.kpu.go.id/) to see percentage of real count

1: 31,373,211 - 24.4911% (H. ANIES RASYID BASWEDAN, Ph.D. - Dr. (H.C.) H. A. MUHAIMIN ISKANDAR)
2: 75,354,223 - 58.8244% (H. PRABOWO SUBIANTO - GIBRAN RAKABUMING RAKA)
3: 21,372,942 - 16.6845% (H. GANJAR PRANOWO, S.H., M.I.P. - Prof. Dr. H. M. MAHFUD MD)
```
This website has been created by Ridwan Halim (ridwaanhall) to provide information regarding the vote results for Presidential and Vice-Presidential Candidates, as The General Election Commissions (KPU) website does not display this information.

## `secrets` and `real_count_pemilu2024` folder will publish at March 20, 2024
![pemilu2024.kpu.go.id.png](image/pemilu2024.kpu.go.id.png)

## how to use?
## how to check real count?

### 1. search in google: ridwaanhall
1. search in google: ridwaanhall

### 2. clone this repo
2. clone this repo

```bash
git clone https://github.com/ridwaanhall/pemilu2024.kpu.go.id.git
```

### 3. run file `run.py`
3. run file `run.py`

4. select the number of option

## contact me

Expand Down
23 changes: 22 additions & 1 deletion base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def __init__(self):
self.urls = {
"1": f"{Config.base_url}/pemilu/ppwp.json",
"2": f"{Config.base_url}/wilayah/pemilu/ppwp/0.json",
"3": f"{Config.base_url}/pemilu/hhcw/ppwp.json"
"3": f"{Config.base_url}/pemilu/hhcw/ppwp.json",
"4": f"{Config.base_url}/pemilu/ds/ppwp.json"
}

def perform_option(self, option):
Expand All @@ -43,6 +44,8 @@ def perform_option(self, option):
self.regional_statistics()
elif option == "7":
self.total_statistics()
elif option == "9":
self.election_disputes()
else:
print("Invalid option. Please choose 1, 2, 3, 4, 5, 6, or 7.")

Expand Down Expand Up @@ -111,6 +114,24 @@ def regional_statistics(self):
else:
continue

def election_disputes(self):
disputes = DataFetcher.get_data(self.urls["4"])

if disputes:
print(disputes)
# for dispute in disputes:
# print(f"no_sk_kpu: {dispute['no_sk_kpu']}")
# print(f"tgl_sk_kpu: {dispute['tgl_sk_kpu']}")
# print(f"nama_prov: {dispute['nama_prov']}")
# print(f"nama_kab: {dispute['nama_kab']}")
# print(f"nama_kec: {dispute['nama_kec']}")
# print(f"nama_kel: {dispute['nama_kel']}")
# print(f"no_tps: {dispute['no_tps']}")
# print(f"tipe_usl: {dispute['tipe_usl']}")
else:
print("Failed to fetch data from URL 4.")


class FormattedDate:
def __init__(self, date_string):
self.date_string = date_string
Expand Down
Binary file added image/pemilu2024.kpu.go.id.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def clear_screen():
print("| search detail option: |")
print("| 8. search detail |")
print("+----------------------------------------+")
print("| 9. LIST OF DISPUTES |")
print("+----------------------------------------+")
print("| 0. Exit |")
print("+========================================+")

Expand Down
13 changes: 6 additions & 7 deletions test/get_json_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ def fetch_data(self):
response = requests.get(self.url, headers=self.headers)
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)

json_data = response.json() # Convert response to JSON format
return json_data
print("Status Code:", response.status_code)
print("Status Text:", response.reason)
# print("Response Body:", response.text)

except requests.exceptions.RequestException as e:
print("Error fetching data:", e)
return None

if __name__ == "__main__":
url = "https://sirekap-obj-data.kpu.go.id/wilayah/pemilu/ppwp/99.json"
url = "https://sirekap-obj-data.kpu.go.id/wilayah/pemilu/ppwp/0.json"
# url = input("Enter URL: ")
data_fetcher = DataFetcher(url)
json_data = data_fetcher.fetch_data()
if json_data:
print(json_data)
data_fetcher.fetch_data()

0 comments on commit 6a86a82

Please sign in to comment.