Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
eranlif
Participant
Jump to solution

Error when using the Python SDK

Hi, all,

I'm trying to use the cp_hec_api_python_sdk and I'm getting a strange error. The code:

CPHEC = CPHEC(ClientID, SecretKey, region)

eventsearchdate = '2023-10-01T09:12:33.001Z'

eventtypes = ['phishing']
eventsearch = CPHEC.event_query(eventsearchdate)
print(eventsearch)

Returns:

{'responseEnvelope': {'requestId': '7b81b4d0-c47d-4e49-9e06-346732e8c33d', 'responseCode': 422, 'responseText': '{"detail":[{"loc":["header","x-cloud-sec-scope"],"msg":"string does not match regex \\"^[a-zA-Z\\\\-0-9]+:[a-zA-Z\\\\-0-9]+(,[a-zA-Z\\\\-0-9]+:[a-zA-Z\\\\-0-9]+)*$\\"","type":"value_error.str.regex","ctx":{"pattern":"^[a-zA-Z\\\\-0-9]+:[a-zA-Z\\\\-0-9]+(,[a-zA-Z\\\\-0-9]+:[a-zA-Z\\\\-0-9]+)*$"}},{"loc":["body","request_scope",0],"msg":"string does not match regex \\"^[a-zA-Z\\\\-0-9]+:[a-zA-Z\\\\-0-9]+$\\"","type":"value_error.str.regex","ctx":{"pattern":"^[a-zA-Z\\\\-0-9]+:[a-zA-Z\\\\-0-9]+$"}}]}', 'recordsNumber': 0, 'scrollId': ''}}

 Any ideas?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
eranlif
Participant

In the end, Support suggested that I use the underlying Avanan REST API (https://www.avanan.com/docs/avanan-smart-api).

They generated the needed credentials (Client-ID, Client-secret and Host), and now I can interact with HEC using REST calls.

View solution in original post

0 Kudos
3 Replies
PhoneBoy
Admin
Admin
0 Kudos
eranlif
Participant

Any news?

0 Kudos
eranlif
Participant

In the end, Support suggested that I use the underlying Avanan REST API (https://www.avanan.com/docs/avanan-smart-api).

They generated the needed credentials (Client-ID, Client-secret and Host), and now I can interact with HEC using REST calls.

0 Kudos
Upcoming Events

    CheckMates Events