TECHS-Technological-Solutions / ocpi

Python implementation of the Open Charge Point Interface (OCPI)
MIT License
49 stars 15 forks source link

detail "Not Found" #47

Open ace-roger opened 1 year ago

ace-roger commented 1 year ago

Hi,

when I am running the v_2_2_1 example as a fast API app - getting {"detail":"Not Found"} on server.

Also, can you suggest, how to run and use modules for emsp role

statiqantriksh commented 1 year ago

@ace-roger Can help me with the endpoint you are trying to hit?

ace-roger commented 1 year ago

Hi @statiqantriksh,

I was running it on my local machine v_2_2_1 example as given in the docs using the master branch.

Plan was to go through all modules from emsp perspective, maybe location first

Do guide me

Thanks

statiqantriksh commented 1 year ago

@ace-roger Try this endpoint from your local post man

http://<IP:PORT>/ocpi/cpo/2.2.1

You can also configure your main.py as mentioned below


import uvicorn
from cpo import get_application
from cpo.core import enums
from cpo.modules.versions.enums import VersionNumber
from datetime import datetime
from cpo.infra.mysql.connection import db as database
from cpo.core.crud import Crud
from cpo.core.adapter import Adapter
from cpo.core.logger.config import logger
from fastapi.responses import JSONResponse
# from starlette.websockets import WebSocket, WebSocketDisconnect
# from fastapi import WebSocket, WebSocketDisconnect
import os

app = get_application(
    [VersionNumber.v_2_2_1, VersionNumber.v_2_1_1],
    [enums.RoleEnum.cpo, enums.RoleEnum.emsp],
    Crud,
    Adapter,
)

@app.on_event("startup")
async def startup():
   print("Project has started")

if __name__ == "__main__":
    uvicorn.run("app:app", host="0.0.0.0", port=8000, log_level="info")
`
ace-roger commented 1 year ago

Hi Antriksh,

Thanks for responding.

Unable to get any output.

Doubt - In main.py -> cpo.core = py-ocpi.core - Is this correct? - No module as cpo

VictorTechs commented 4 days ago

Hello @ace-roger, Sorry for long response, could you tell me if everything is working now? Regarding the second issue, in the main file, there is py-ocpi.core which is correctly imported, as I checked, could you confirm?