Leblad py
the python version of leblad library, provide a list of Algerian administrative areas with many useful APIs based on dzcode-io/leblad
Meta
Coverage
Getting started
Usage
Installation
pip install leblad
API
import
import leblad
api = leblad.Api()
getWilayaList
Returns a list of algeria provinces or wilayas
Arguments
- return : Array of Wilaya Object attributes to keep
Examples
allWilayasDetails = api.getWilayaList()
getWilayaByZipCode
Returns a wilaya that includes the given zipCode
Arguments
zip_codenumber (required) A zip code return : Array of Wilaya Object attributes to keep Examples
wilaya = api.getWilayaByZipCode(zip_code)
getWilayaByCode
Returns a wilaya that includes the given wilaya code (mattricule).
Arguments
wilaya_codenumber (required) A zip code return : Array of Wilaya Object attributes to keep
Examples
wilaya = api.getWilayaByCode(14)
print(wilaya) # will print the wilaya object ({name: "Tiaret"...})
getAdjacentWilayas
Takes a wilaya code (matricule) and returns a list of adjacent wilayas codes
Arguments
wilaya_code(required) the Wilaya's "matricule"
Examples
adjacent_wilayas = api.getAdjacentWilaya(31)
print(adjacent_wilayas) # will print [46, 22, 29, 27]
getZipCodesForWilaya
Takes a wilaya code (matricule) and returns a list of Respective Zip-Codes for that wilaya
Arguments
wilaya_code(required) the Wilaya's "matricule"
Examples
wilayas_zipcodes = api.getZipCodesForWilaya(31)
print(wilayas_zipcodes) #returns list of zip codes for wilaya 31
getWilayasByPhoneCode
Takes a phone code and returns the matching wilaya.
Arguments
phone_code(required) the Wilaya's "phoneCode"
Examples
wilaya = api.getWilayasByPhoneCode(34)
print(wilaya) # will the wilaya object ({name: "Béjaïa"...})
getWilayaByDairaName
Takes a daira name and returns the matching wilaya.
Arguments
dairaName: string(required) the Wilaya's "dairaName"
Examples
wilaya = api.getWilayaByDairaName("OUED RHIOU")
print(wilaya) #will print the wilaya object ({name: "Relizane"...})
getBaladyiatsForDaira
Takes a daira code and returns the matching baladyiats.
Arguments
daira_code: int(required) the Wilaya's "dairaName"
Examples
baladiyats = api.getBaladyiatsForDaira(1401)
print(baladiyats) # will return baladyiats for daira of "Tiaret"
getDairatsForWilaya
Takes a wilaya code (matricule) ans returns list of all dairats of that wilaya.
Arguments
wilaya_code: number(required) the Wilaya's "matricule"
Examples
wilaya_dairats = api.getDairatsForWilaya(3)
print(wilaya_dairats) #returns list of dairats for wilaya 3
getPhoneCodesForWilaya
Takes a wilaya code (matricule) and returns a list of phone codes for given wilaya
Arguments
wilaya_code: number(required) the Wilaya's "matricule"
Examples
phones = api.getPhoneCodesForWilaya(22)
print(phones) #returns list of phone codes for wilaya 22
getFirstPhoneCodeForWilaya
Takes a wilaya code (matricule) and returns the first phone code from a list of phone codes for given wilaya
Arguments
wilayaCode: number(required) the Wilaya's "matricule"
Examples
first_phonecode = api.getFirstPhoneCodeForWilaya(16)
print(first_phonecode) #returns first phone code for wilaya 16
getBaladyiatsForWilaya
Takes a wilaya code (mattricule) and returns array of Baladiyates of wilaya.
Arguments
wilaya_code: number(required) the Wilaya's "matricule"
Examples
wilaya_bladiyats = api.getBaladyiatsForWilaya(31)
print(wilaya_bladiyats) # will print the baladyiats list ([{ code: 3125, name: 'AIN KERMA'..},{ code: 3105,name: 'ES SENIA',}])
getWilayaByBaladyiaName
Takes a Baladyia name and returns wilaya in which baladyia is located.
Arguments
baladya: number(required) the Baladyia name
Examples
wilaya = api.getWilayaByBaladyiaName('ES SENIA')
print(wilaya) # will print the wilaya object ({name: "Oran"...})
getDairaByBaladyiaName
Takes a Baladyia name and returns daira in which baladyia is located.
Arguments
baladyia_name: string(required) the Baladyia name
Examples
daira =api.getDairaByBaladyiaName('ES SENIA')
print(daira) #will print the daira object ({name: "ES SENIA"...})
getFullAdjacentWilaya
Takes a wilaya code and returns a list of adjacent wilaya objects
Arguments
wilaya_code: integer(required) the wilaya code (matricule)
Examples
adjacent_wilaya_obj =api.getFullAdjacentWilaya('14')
print(adjacent_wilaya_obj) #will print a list of objects of adjacent wilaya
getAdjacentWilaya
Takes a wilaya code and returns a list of adjacent wilayas
Arguments
wilaya_code: integer(required) the wilaya code (matricule)
Examples
adjacent_wilaya_obj =api.getAdjacentWilaya('14')
print(adjacent_wilaya_obj) #will print a list of objects of adjacent wilaya
Testing
Simply run
python -m unittest tests/test_index.py
License
Copyright (c) 2020 Licensed under the MIT license.
Metadata
Release files for leblad 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| leblad-0.0.4.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| leblad-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / leblad-0.0.4.tar.gz
| Download URL | leblad-0.0.4.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c147a942c93c8c47f1c695c2d0be91992195ca6baf23641a1710813e6adfbfb0
|
|
BLAKE2b-256 checksum How to use checksums |
3dbc4df227412a98b0739ca19fd065f26a60c46466185117e94da3b07cc78638
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1
|
Release files / leblad-0.0.4-py3-none-any.whl
| Download URL | leblad-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8692a394f04ab59785ee97adee330969220b2ecf1e879795ae3461f55b50cd36
|
|
BLAKE2b-256 checksum How to use checksums |
5b914207e4dbbaa868b7d4efd9d6759a0237ee739c511c82c4e305bd2789be7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1
|