Adding request info does not use specified request_id for BatchRequestContent
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 45/100
Direzione di ricerca
Inizia in msgraph_core/requests/batch_request_content.py, in add_request_information, e segui il modo in cui viene creato il BatchRequestItem in msgraph_core/requests/batch_request_item.py. Verifica che una request_id fornita rimanga l'ID dell'elemento e che gli ID generati continuino a funzionare quando non viene fornito alcun ID personalizzato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
Trying to add batch request steps with custom request IDs so that I can track the responses, however the custom request ID is always overridden to a random uuid
Expected behavior
Should be able to specify a custom request ID as specified in the function doc strings and in samples.
How to reproduce
You can track this through:
msgraph_core/requests/batch_request_content.py
def add_request_information(
self, request_information: RequestInformation, request_id: Optional[str] = None
) -> None:
"""
Adds a request to the batch request content.
Args:
request_information (RequestInformation): The request information to add.
request_id: Optional[str]: The request id to add.
"""
request_id = request_id if request_id else str(uuid.uuid4())
self.add_request(request_id, BatchRequestItem(request_information))
When creating the BatchRequestItem (msgraph_core/requests/batch_request_item.py), we've not passed the request ID into the init, so a random one is assigned to the Item:
def __init__(
self,
request_information: Optional[RequestInformation] = None,
id: str = "",
depends_on: Optional[list[Union[str, 'BatchRequestItem']]] = []
):
"""
Initializes a new instance of the BatchRequestItem class.
Args:
request_information (RequestInformation): The request information.
id (str, optional): The ID of the request item. Defaults to "".
depends_on (Optional[list[Union[str, BatchRequestItem]], optional):
The IDs of the requests that this request depends on. Defaults to None.
"""
if request_information is None or not request_information.http_method:
raise ValueError("HTTP method cannot be Null/Empty")
self._id = id or str(uuid4())
The custom one is then only used if there isn't one already on the request, which is impossible here because of the initialisation of the item object:
def add_request(self, request_id: Optional[str], request: BatchRequestItem) -> None:
"""
Adds a request to the batch request content.
Args:
request_id (Optional[str]): The request id to add.
request (BatchRequestItem): The request to add.
"""
if len(self.requests) >= BatchRequestContent.MAX_REQUESTS:
raise RuntimeError(f"Maximum number of requests is {BatchRequestContent.MAX_REQUESTS}")
if not request.id:
request.id = request_id if request_id else str(uuid.uuid4())
So it's impossible for you to set a custom request ID through the add_request_information function. Either we should pass the custom one into the initialisation of the Item, or the "add_request" function should be checking for whether we have a request_id not a request.id. Suspect it should be the latter otherwise the function signature makes no sense.
SDK Version
1.17.0 of the SDK, 1.20.0 of msgraph-core
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_
- Lingua principale
- Python
- Stelle
- 288
- Fork
- 53
- Merge medio
- 40m
- PR unite (30g)
- 1
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoftgraph/msgraph-sdk-python-core
-
Logging to root loggerApertastatus:waiting-for-triage type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
microsoftgraph/msgraph-sdk-python-core#1078 ·
I maintainer di solito rispondono entro 1 giorno
-
Missing 'deprecated' dependencyForse già presa @Daiyuanranfeng l’ha presa 3 giorni fa. Apertastatus:waiting-for-triage type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoftgraph/msgraph-sdk-python-core#1030 · 4 commenti · 4 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Replace httpx with httpx2Apertastatus:waiting-for-triage type:feature
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
microsoftgraph/msgraph-sdk-python-core#1115 ·
I maintainer di solito rispondono entro 1 giorno
-
BatchRequestItem loses query parameters from RequestInformationForse già presa @Daiyuanranfeng l’ha presa 3 giorni fa. Apertastatus:waiting-for-triage type:bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
microsoftgraph/msgraph-sdk-python-core#1035 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
status:waiting-for-triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
microsoftgraph/msgraph-sdk-python-core#935 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoftgraph/msgraph-sdk-python-core
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
trycua/hermes-cua-spaces#17 ·
-
area:codegen backend:hip bug direction:output good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
status:waiting-for-triage type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
microsoftgraph/msgraph-sdk-python#1628 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
nautechsystems/nautilus_trader#5718 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: reme CLI crashes when the running server used a relative config pathForse già presa @nurlanmnn l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
agentscope-ai/ReMe#770 ·
I maintainer di solito rispondono entro 1 giorno