POST /crm/v3/exports/export/async

Hi all,

I’m running into an invalid syntax issue with the code below -

from hubspot.crm.exports.export.async import PublicExportRequest, ApiException

I followed the API documentation, so I’m unsure as to why I’m receiving this error. Any thoughs on what could be causing this?

Thanks!

Hi, @taylorgruende :waving_hand: Can you provide an example request and response along with the full error body, please? It’s likely there is not enough information here for our community to work with.

Best,

Jaycee

Hi Jaycee,

I haven’t created a request yet because I can’t get past the packages/modules not installing correctly. Here’s the full code for reference -

import hubspot
from pprint import pprint
from hubspot.crm.exports.export.async import PublicExportRequest, ApiException

I’m receiving an invalid syntax error for line 3. I’m assuming it has something to do with the .async feature. I tried removing it but I still had the same issue.

any updates I am having the same issue.

from hubspot.crm.exports.export.async import ApiException
^^^^^
SyntaxError: invalid syntax

Python 3.10.11

pip install --upgrade hubspot-api-client

@Jaycee_Lewis Same here. I followed code shown on this page.

The code :

import hubspot
from pprint import pprint
from hubspot.crm.exports.export.async import PublicExportRequest, ApiException

client = hubspot.Client.create(access_token="MY_ACCESS_TOKEN")

public_crm_search_request = {
 # my request
}

public_export_request = PublicExportRequest(export_type="VIEW", format="XLS", export_name="string", object_properties=["string"], associated_object_type="string", object_type="string", language="EN", public_crm_search_request=public_crm_search_request)
try:
 api_response = client.crm.exports.export.async.core_api.start(public_export_request=public_export_request)
 pprint(api_response)
except ApiException as e:
 print("Exception when calling core_api->start: %s\n" % e)

The errors :

[{
	"resource": "filepath",
	"owner": "_generated_diagnostic_collection_name_#1",
	"severity": 8,
	"message": "Expected module name",
	"source": "Pylance",
	"startLineNumber": 3,
	"startColumn": 33,
	"endLineNumber": 3,
	"endColumn": 38
},{
	"resource": "filepath",
	"owner": "_generated_diagnostic_collection_name_#1",
	"severity": 8,
	"message": "Expected \"import\"",
	"source": "Pylance",
	"startLineNumber": 3,
	"startColumn": 33,
	"endLineNumber": 3,
	"endColumn": 38
},{
	"resource": "filepath",
	"owner": "_generated_diagnostic_collection_name_#1",
	"severity": 8,
	"message": "Statements must be separated by newlines or semicolons",
	"source": "Pylance",
	"startLineNumber": 3,
	"startColumn": 33,
	"endLineNumber": 3,
	"endColumn": 38
},{
	"resource": "filepath",
	"owner": "_generated_diagnostic_collection_name_#1",
	"severity": 8,
	"message": "Expected \"def\", \"with\" or \"for\" to follow \"async\"",
	"source": "Pylance",
	"startLineNumber": 3,
	"startColumn": 33,
	"endLineNumber": 3,
	"endColumn": 38
},{
	"resource": "filepath",
	"owner": "_generated_diagnostic_collection_name_#1",
	"severity": 8,
	"message": "Expected attribute name after \".\"",
	"source": "Pylance",
	"startLineNumber": 13,
	"startColumn": 45,
	"endLineNumber": 13,
	"endColumn": 46
},{
	"resource": "filepath",
	"owner": "_generated_diagnostic_collection_name_#1",
	"severity": 8,
	"message": "Statements must be separated by newlines or semicolons",
	"source": "Pylance",
	"startLineNumber": 13,
	"startColumn": 46,
	"endLineNumber": 13,
	"endColumn": 51
},{
	"resource": "filepath",
	"owner": "_generated_diagnostic_collection_name_#1",
	"severity": 8,
	"message": "Expected \"def\", \"with\" or \"for\" to follow \"async\"",
	"source": "Pylance",
	"startLineNumber": 13,
	"startColumn": 46,
	"endLineNumber": 13,
	"endColumn": 51
},{
	"resource": "filepath",
	"owner": "_generated_diagnostic_collection_name_#1",
	"severity": 8,
	"message": "Expected expression",
	"source": "Pylance",
	"startLineNumber": 13,
	"startColumn": 111,
	"endLineNumber": 14,
	"endColumn": 1
},{
	"resource": "filepath",
	"owner": "_generated_diagnostic_collection_name_#1",
	"code": {
		"value": "reportMissingImports",
		"target": {
			"$mid": 1,
			"path": "/microsoft/pyright/blob/main/docs/configuration.md",
			"scheme": "https",
			"authority": "github.com",
			"fragment": "reportMissingImports"
		}
	},
	"severity": 4,
	"message": "Import \"hubspot.crm.exports.export\" could not be resolved",
	"source": "Pylance",
	"startLineNumber": 3,
	"startColumn": 6,
	"endLineNumber": 3,
	"endColumn": 33
},{
	"resource": "filepath",
	"owner": "_generated_diagnostic_collection_name_#1",
	"code": {
		"value": "reportUndefinedVariable",
		"target": {
			"$mid": 1,
			"path": "/microsoft/pyright/blob/main/docs/configuration.md",
			"scheme": "https",
			"authority": "github.com",
			"fragment": "reportUndefinedVariable"
		}
	},
	"severity": 4,
	"message": "\"PublicExportRequest\" is not defined",
	"source": "Pylance",
	"startLineNumber": 11,
	"startColumn": 25,
	"endLineNumber": 11,
	"endColumn": 44
},{
	"resource": "filepath",
	"owner": "_generated_diagnostic_collection_name_#1",
	"code": {
		"value": "reportUndefinedVariable",
		"target": {
			"$mid": 1,
			"path": "/microsoft/pyright/blob/main/docs/configuration.md",
			"scheme": "https",
			"authority": "github.com",
			"fragment": "reportUndefinedVariable"
		}
	},
	"severity": 4,
	"message": "\"ApiException\" is not defined",
	"source": "Pylance",
	"startLineNumber": 15,
	"startColumn": 8,
	"endLineNumber": 15,
	"endColumn": 20
}]

The following error might be the one that causes all errors :

Import \"hubspot.crm.exports.export\" could not be resolved

Seems like “crs.exports” does not exists ?

Has this been solved? I’m having the exact same problem with a simple test in Spyder.

Also still seeing this issue using the node hubspot api package.

import hubspot from ‘@hubspot/api-client’;

const hubspotClient = new hubspot.Client({accessToken: ‘****************’});

console.log(hubspotClient.crm.exports);

//exorts is undefined