Error 400 after successful file upload
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Comece reproduzindo o upload mostrado na issue com msgraph-sdk-python 1.17.0, concentrando-se em LargeFileUploadTask.upload() e no APIError 400 relatado. Inspecione o resultado do upload e o tratamento de erros ao redor da requisição para determinar por que um upload bem-sucedido ainda produz uma exceção. O trabalho estará concluído quando o comportamento estiver explicado e o SDK relatar o resultado adequadamente ou documentar o workaround necessário.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
I'm testing an upload process, here's an anonymized snippet of the code:
async def _upload_file(self, drive_id, filename, file_content, folder_name=None):
properties = DriveItemUploadableProperties(
additional_data={
"@microsoft.graph.conflictBehavior" : "replace",
},
)
request_body = CreateUploadSessionPostRequestBody(item=properties)
if folder_name is not None:
filename = folder_name + '/' + filename
session = await (
self.client
.drives.by_drive_id(drive_id)
.items.by_drive_item_id(f"root:/{filename}:")
.create_upload_session.post(body=request_body)
)
large_file_session = LargeFileUploadSession(
upload_url=session.upload_url,
expiration_date_time=session.expiration_date_time,
additional_data=session.additional_data,
is_cancelled=False,
next_expected_ranges=session.next_expected_ranges
)
task = LargeFileUploadTask(upload_session=large_file_session, request_adapter=self.client.request_adapter, stream=file_content)
upload_result = await task.upload()
return upload_result
The upload proceeds as expected, but I get the following exception anyway:
APIError
Code: 400
message: The server returned an unexpected status code and no error class is registered for this code 400
Expected behavior
Either a more clear error code if there is a problem I'm not seeing, or no error after a successful upload.
How to reproduce
See code in first section.
SDK Version
1.17.0
Latest version known to work for scenario above?
No response
Known Workarounds
Ignoring the exception for error 400 works, but is not ideal.
Debug output
APIError
Code: 400
message: The server returned an unexpected status code and no error class is registered for this code 400
Configuration
Windows 11, x64. I haven't tested on any other systems at present.
Other information
This may not be related to the SDK at all, but if it is an error in the request that isn't clear from the documentation I've read on this. I will echo comments elsewhere that the documentation on using the SDK for uploads is extremely limited and I had to cobble a lot of this together from responses to other questions here.
- Linguagem predominante
- Python
- Estrelas
- 630
- Forks
- 96
- Merge médio
- 15h 20min
- PRs com merge (30d)
- 3
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de microsoftgraph/msgraph-sdk-python
-
status:waiting-for-triage type:bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
microsoftgraph/msgraph-sdk-python#1570 ·
-
status:waiting-for-triage type:bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
microsoftgraph/msgraph-sdk-python#1563 ·
-
Needs: Attention :wave: type:bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
microsoftgraph/msgraph-sdk-python#1287 · 2 comentários · 1 reação ·
-
status:waiting-for-triage type:bug
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 52/100
microsoftgraph/msgraph-sdk-python#1578 ·
-
Batch Request Support Abertastatus:waiting-for-triage
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
microsoftgraph/msgraph-sdk-python#1557 ·
Todas as issues de microsoftgraph/msgraph-sdk-python
Issues semelhantes
-
agent-ready documentation needs-triage
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
-
documentation
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
-
instance instance add
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
searxng/searx-instances#939 · 1 comentário ·
-
area-deployment area-integrations triage:bot-seen
Dificuldade 2/5 Meio dia Facilidade para iniciantes 86/100