-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c28114c
Showing
48 changed files
with
162,869 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github: asepscareer | ||
custom: ['https://saweria.co/mestitahu'] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: pip | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
app/__pycache__/__init__.cpython-310.pyc | ||
app/__pycache__/app.cpython-310.pyc | ||
src/__pycache__/__init__.cpython-310.pyc | ||
src/__pycache__/base.cpython-310.pyc | ||
src/__pycache__/res.cpython-310.pyc | ||
src/__pycache__/utils.cpython-310.pyc | ||
myenv/* |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 rizki | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
API Kode Pos Indonesia ini dibuat dengan sukarela, bisa digunakan jika bermanfaat. Lebih dari itu semoga bisa berkontribusi untuk mengembangkan API ini, terimakasih. | ||
|
||
## Penggunaan di local server | ||
```bash | ||
git clone https://github.com/asepscareer/kodepos-api.git | ||
``` | ||
|
||
```bash | ||
cd kodepos-api && pip install -r requirements.txt | ||
``` | ||
|
||
```bash | ||
export FLASK_APP=main.py | ||
flask run | ||
``` | ||
|
||
# kodepos-api | ||
kumpulan data kode pos negara Indonesia. | ||
|
||
### penggunaan | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th>No</th> | ||
<th>Keterangan</th> | ||
<th>Endpoint</th> | ||
<th>Parameter</th> | ||
<th>Method</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>1</td> | ||
<td>Get All Data Nasional</td> | ||
<td>/api/v1/get-data-nasional</td> | ||
<td>Tidak ada</td> | ||
<td>GET</td> | ||
</tr> | ||
<tr> | ||
<td>2</td> | ||
<td>Get All Data Nasinal (Pagination)</td> | ||
<td>/api/v1/get-nasional?start={}&limit={}</td> | ||
<td>Ada</td> | ||
<td>GET</td> | ||
</tr> | ||
|
||
<tr> | ||
<td>3</td> | ||
<td>Get Daftar Provinsi</td> | ||
<td>/api/v1/daftar-daerah</td> | ||
<td>Tidak ada</td> | ||
<td>GET</td> | ||
</tr> | ||
|
||
<tr> | ||
<td>4</td> | ||
<td>Ekonomi</td> | ||
<td>/ekonomi</td> | ||
<td>Tidak ada</td> | ||
<td>GET</td> | ||
</tr> | ||
|
||
<tr> | ||
<td>5</td> | ||
<td>Get Data Provinsi</td> | ||
<td>/api/v1/get-data-provinsi/{}</td> | ||
<td>Ada</td> | ||
<td>GET</td> | ||
</tr> | ||
|
||
<tr> | ||
<td>6</td> | ||
<td>Setup Data Kode Pos Provinsi</td> | ||
<td>/api/v1/reset-data-provinsi</td> | ||
<td>Tidak ada</td> | ||
<td>GET</td> | ||
</tr> | ||
|
||
<tr> | ||
<td>7</td> | ||
<td>Setup Data Kode Pos Nasional</td> | ||
<td>/api/v1/reset-data-nasional</td> | ||
<td>Tidak ada</td> | ||
<td>GET</td> | ||
</tr> | ||
|
||
</tbody> | ||
</table> | ||
|
||
### Postman Collection | ||
|
||
[klik disini] (https://github.com/asepscareer/kodepost-api/blob/master/kodepos-api.json) | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .app import app |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from flask import Flask, request | ||
from src.res import success, badRequest | ||
from src.base import get_daerah, setup_provinsi, setup_nasional, getdata_nasional, getdata_provinsi, get_paginated_list | ||
|
||
app = Flask(__name__) | ||
|
||
@app.route('/api/v1/daftar-daerah', methods=['GET']) | ||
def getdaerah(): | ||
response = get_daerah() | ||
return success(response) | ||
|
||
@app.route('/api/v1/reset-data-provinsi', methods=['GET']) | ||
def setupprovinsi(): | ||
response = setup_provinsi() | ||
return success(response) | ||
|
||
@app.route('/api/v1/get-data-provinsi/<provinsi_name>', methods=['GET']) | ||
def getdataprovinsi(provinsi_name): | ||
try: | ||
provinsi = provinsi_name | ||
response = getdata_provinsi(params=provinsi) | ||
return success(response) | ||
except: | ||
response = 'Sesuaikan dengan yang ada pada endpoint Get Daftar Provinsi' | ||
return badRequest(message= response, values= None) | ||
|
||
@app.route('/api/v1/reset-data-nasional', methods=['GET']) | ||
def setupnasional(): | ||
response = setup_nasional() | ||
return success(response) | ||
|
||
@app.route('/api/v1/get-data-nasional', methods=['GET']) | ||
def getdatanasional(): | ||
response = getdata_nasional() | ||
return success(response) | ||
|
||
@app.route('/api/v1/get-nasional', methods=['GET']) | ||
def getnasional2(): | ||
data = getdata_nasional() | ||
response = get_paginated_list( | ||
data, '/api/v1/get-nasional', | ||
start=request.args.get('start', 1), | ||
limit=request.args.get('limit', 20) | ||
) | ||
return success(response) | ||
|
Oops, something went wrong.