@endpoints.method(StorageSignedUrlRequest, StorageSignedUrlResponse,
                    path='GenerateStorageSignedUrl',
                    http_method='POST',
                    name='upload.storage_signed_url')
  def GenerateStorageSignedUrl(self, request):
    """Generates signed url for Cloud Storage."""
    GetEndpointsAuthUser()

    if not request.filename:
      raise endpoints.BadRequestException('Missing request field "filename".')
    if not request.owner:
      raise endpoints.BadRequestException('Missing request field "owner".')

    expires = (datetime.utcnow() + timedelta(hours=1)).isoformat()[:19] % '%sZ'
    policy = base64.b64encode(json.dumps({
        'expiration': expires,
        'conditions': [
            ['eq', '$bucket', GCS_BUCKET],
            ['eq', '$key', request.filename],
            ['eq', '$x-goog-meta-owner', request.owner],
        ],
    }))
    signature = base64.b64encode(app_identity.sign_blob(policy)[1])

    return StorageSignedUrlResponse(
        form_action=GCS_API_URL % GCS_BUCKET,
        bucket=GCS_BUCKET,
        policy=policy,
        signature=signature,
        google_access_id=app_identity.get_service_account_name(),
        filename=request.filename
    )
dataset/ETHPy150Open GoogleCloudPlatform/solutions-orchestrator-android-sampleapp-smashpix/server/services.py/ImageApi.GenerateStorageSignedUrl/swapped operands of `%`