(
request: Request,
filepath: str,
block_indexes_str: str,
block_size: int, # we grab 2x this many ints/floats
format: str,
datasource: DataSource = Depends(datasource_repo.get),
azure_client: AzureBlobClient = Depends(AzureBlobClient),
access_allowed=Depends(check_access),
)
| 43 | ) |
| 44 | @cancel_on_disconnect |
| 45 | async def get_iq_data( |
| 46 | request: Request, |
| 47 | filepath: str, |
| 48 | block_indexes_str: str, |
| 49 | block_size: int, # we grab 2x this many ints/floats |
| 50 | format: str, |
| 51 | datasource: DataSource = Depends(datasource_repo.get), |
| 52 | azure_client: AzureBlobClient = Depends(AzureBlobClient), |
| 53 | access_allowed=Depends(check_access), |
| 54 | ): |
| 55 | if access_allowed is None: |
| 56 | raise HTTPException(status_code=403, detail="No Access") |
| 57 | if not datasource: |
| 58 | raise HTTPException(status_code=404, detail="Datasource not found") |
| 59 | if hasattr(datasource, "sasToken"): |
| 60 | if datasource.sasToken: |
| 61 | azure_client.set_sas_token(decrypt(datasource.sasToken.get_secret_value())) |
| 62 | |
| 63 | try: |
| 64 | block_indexes = [int(num) for num in block_indexes_str.split(",")] |
| 65 | |
| 66 | return StreamingResponse( |
| 67 | calculate_iq_data( |
| 68 | block_indexes, |
| 69 | block_size, |
| 70 | get_bytes_per_iq_sample(format), |
| 71 | get_file_name(filepath, ApiType.IQDATA), |
| 72 | azure_client, |
| 73 | request, |
| 74 | ), |
| 75 | media_type="application/octet-stream", |
| 76 | ) |
| 77 | |
| 78 | except Exception as e: |
| 79 | raise HTTPException(status_code=400, detail=str(e)) |
| 80 | |
| 81 | |
| 82 | async def calculate_iq_data( |
nothing calls this directly
no test coverage detected