the python version of leblad library, provide a list of Algerian administrative areas with many useful APIs based on dzcode-io/leblad
Coverage
pip install leblad
import leblad
api = leblad.Api()
Returns a list of algeria provinces or wilayas
- return : Array of Wilaya Object attributes to keep
allWilayasDetails = api.getWilayaList()
Returns a wilaya that includes the given zipCode
zip_code
number (required) A zip code return : Array of Wilaya Object attributes to keep Examples
wilaya = api.getWilayaByZipCode(zip_code)
Returns a wilaya that includes the given wilaya code (mattricule).
wilaya_code
number (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"...})
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]
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
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"...})
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"...})
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"
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
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
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
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',}])
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"...})
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"...})
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
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
Simply run
python -m unittest tests/test_index.py
Copyright (c) 2020 Licensed under the MIT license.