Highly Organized Business Directory API
41k filtered records out of 100k
Business Directory API built on top of FastAPI and Uvicorn Server uses JWT for authentication and authorization. FastAPI has native support for Uvicorn,Uvicorn is an ASGI server, which means it communicates using the Asynchronous Server Gateway Interface, a modern standard for Python asynchronous applications.
├── .gitignore (to preventing unnecessary files from being tracked)
├── LICENSE (for specifying the terms under which the code can be used, modified, and distributed)
├── README.md (a github file repository is crucial for providing essential information about your project)
├──
├── requirements.txt ( For keeping all the library name wich project is using)
├── app
│ │
│ ├── __init__.py ( Initializing the package from here.)
│ ├── companies.db (A SQLite database file for storing all information related to companies)
│ ├── main.py (The main Python script for running the application)
| |
│ ├── company (A directory containing code related to company management)
│ │ └── __init__.py
| | |── database.py (Python code for interacting with the SQLite database)
| | |── models.py (Python code defining data models for companies)
| | |── oauth2.py (Python code for OAuth2 authentication)
| | |── schemas.py (Python code defining Pydantic schemas for data validation)
| | |── token.py (Python code for generating authentication tokens)
│ │ └─── routes (A directory containing API routes for company-related operations)
│ │ └── __init__.py
| | |── auth.py (Python code defining authentication routes)
| | └── comp.py (Python code defining CRUD operations for companies)
| | └── users.py (Python code defining CRUD operations for users)
|___|
import requests
import json
req = requests.get('https://loham.onrender.com/v1/about')
data_str = req.content.decode('utf-8')
json_data = json.loads(data_str)
print(json.dumps(json_data, indent=4))
curl -X 'GET' \
'https://loham.onrender.com/v1/about' \
-H 'accept: application/json'
{
"Version": "0.0.1",
"Developer": "Abdisa (Netkas) | (0_0)",
"Released Year": "April 10 2024",
"Github": "https://github.com/abdimk/loham"
}
import requests
import json
req = requests.get('https://loham.onrender.com/get_category_count')
data_str = req.content.decode('utf-8')
json_data = json.loads(data_str)
print(json.dumps(json_data, indent=4))
[
{
"categories": "Foreign Suppliers to Ethiopia",
"category_count": 49
},
{
"categories": "Hotels and Restaurants, Tour and Travel",
"category_count": 64
},
{
"categories": "Insurance Brokerage",
"category_count": 18
},
{
"categories": "Micro and Small Enterprises in Ethiopia",
"category_count": 3931
}
]
import requests
import json
id = 609
req = requests.get(f'https://loham.onrender.com/get/{id}')
data_str = req.content.decode('utf-8')
json_data = json.loads(data_str)
print(json.dumps(json_data, indent=4))
The output is based of the specified schema in fastAPI(response schema)
{
"id": 609,
"company_name": "CAROGA PHARMA ETHIOPIA PLC",
"phone_number": "+25 11 4161090/4165159/4654944",
"mobile": "+251 91 1209007",
"fax": "+251 11 4654595",
"sub_city": "Kirkos",
"business_type": "Private",
"location": "Addis Ababa, Ethiopia",
"url": "https://www.2merkato.com/directory/709-caroga-pharma-ethiopia-plc",
"primary_category": "None",
"categories": "Commission Agent"
}
import requests
import json
#common key initals are like agro,pharma,agents,consultancy,export,import
key = 'export' # for example to get companies that have pharma in their name
req = requests.get(f"https://loham.onrender.com/get_with_initals/{key}")
data_str = req.content.decode('utf-8')
json_data = json.loads(data_str)
print(json.dumps(json_data, indent=4))
"returns a list of arryays max 10 for free users"
[
{
"id": 57,
"company_name": "GIGAR TRADING IMPORT, EXPORT & DISTRIBUTOR",
"phone_number": "+251 11 5518267/5505853/54",
"mobile": "+251 91 1201117",
"fax": "+251 11 5502911",
"sub_city": "",
"business_type": "Private",
"location": "Addis Ababa",
"url": "https://www.2merkato.com/directory/11267-gigar-trading-import-export-distributor",
"primary_category": "None",
"categories": "Commercial Agent"
},
{
"id": 68,
"company_name": "Tsegaab Teklu Import Export PLC",
"phone_number": "+251-11-6525213",
"mobile": "",
"fax": "",
"sub_city": "Kirkos",
"business_type": "",
"location": "Tsegaab Teklu Import Export PLC: Import and Export. Kirkos Sub-City Addis Ababa Region 14 15963 City: Addis Ababa Administrative region: Addis Ababa Country: Ethiopia, Addis Ababa, Ethiopia",
"url": "https://www.2merkato.com/directory/16504-tsegaab-teklu-import-export-plc",
"primary_category": "None",
"categories": "Commercial Agent"
}
]
import requests
import json
url = 'https://loham.onrender.com/get_with_initals'
# payload = {
# "company_name": "string", # Optional
# "sub_city": "string", #Optional
# "business_type": "string", #Optional
# "primary_category": "string", #Optional
# "categories": "string" #Optional
# }
payload = {
"sub_city": "yeka",
"business_type": "private",
"categories": "Ethiopian Importers"
}
req = requests.post(url, json=payload)
data_str = req.content.decode('utf')
json_data = json.loads(data_str)
print(json.dumps(json_data, indent=4))
list of arrays max 10 results
[
{
"id": 3511,
"company_name": "Sisay Gulema Building Material General Importer",
"phone_number": "+251 115 15 58 11",
"mobile": "+251 911 21 21 16",
"fax": "+251 115 15 21 24",
"sub_city": "yeka",
"business_type": "Private",
"location": "Urael, Besides Ministry of Agriculture and Urban Development, Addis Ababa, Ethiopia",
"url": "https://www.2merkato.com/directory/14864-sisay-gulema-building-material-general-importer",
"primary_category": "Pipes and Fittings/polypopylene",
"categories": "Ethiopian Importers"
},
{
"id": 3540,
"company_name": "Dagem Kennedy General Trading PLC",
"phone_number": "",
"mobile": "+251 930 11 03 26, +251 911 62 67 84, +251 930 11 03 25",
"fax": "",
"sub_city": "Yeka",
"business_type": "Private",
"location": "22 Mazoria, Behind H&M Building, House #1006, Addis Ababa, Ethiopia",
"url": "https://www.2merkato.com/directory/19748-dagem-kennedy-general-trading-plc",
"primary_category": "Electrical Materials/Equipments",
"categories": "Ethiopian Importers"
}
]
import requests
import json
url = 'https://loham.onrender.com/get_with_phone'
payload = {
"phone_number": "251116",
"limit": 10 # the no of results you want to get
}
req = requests.post(url, json=payload)
data_str = req.content.decode('utf')
json_data = json.loads(data_str)
print(json.dumps(json_data, indent=4))
returns an array of list companies type
Special Thanks to
• Tiangolo for creating FastAPI
Any type of suggestions, pointing out bug or contribution is highly appreciated :).