JWT validation failed: Missing or invalid credentials

Hello,

I am getting the following message when trying to export the monthly table:

JWT validation failed: Missing or invalid credentials

I am able to get all the other tables fine except for the monthly export one. Here is my full block code:

#Helper method that returns an iterator with the documents from all pages
def get_all(url, headers):
# First request
has_more = True

# Keep fetching while there are more records to be returned
while has_more:
    response = requests.get(url, headers=headers)

    # Return the records to be processed by the caller instead of doing the processing here
    yield from response.json()

    url = get_next_page_url(response.headers)
    has_more = url is not None

def get_records(url, auth_headers=combocurve_auth.get_auth_headers()):

df = pd.DataFrame()
tmp_list = []

for record in get_all(url, auth_headers):
    tmp_list.append(record)

return pd.DataFrame(tmp_list).reset_index(drop=True)

And executing this particular project:

project_id = ‘6224a9db21aea9001311d1c7’
url = f’https://api.combocurve.com/v1/projects/{project_id}/wells?take=200

project_wells = get_records(url)

url = f’https://api.combocurve.com/v1/projects/{project_id}/monthly-productions?take=200

project_production = get_records(url)

url = f’https://api.combocurve.com/v1/projects/{project_id}/scenarios?take=200

project_scenarios = get_records(url)
project_scenarios

scenario_id = project_scenarios.id[0]

url = f’https://api.combocurve.com/v1/projects/{project_id}/scenarios/{scenario_id}/econ-runs?take=200

project_econ_runs = get_records(url)

econ_id = project_econ_runs.id[0]
econ_id

well_ids = list(project_wells.id.unique())
well_ids

monthly_export_table = pd.DataFrame()

for well_id in well_ids:
url = f’https://api.combocurve.com/v1/projects/{project_id}/scenarios/{scenario_id}/econ-runs/{econ_id}/monthly-exports/{well_id}?skip=0&take=100
print(url)
monthly_export = get_records(url)

monthly_export_table = pd.concat([monthly_export_table,monthly_export])

monthly_table = monthly_table.reset_index(drop=True)

Hey @eduardomar. We are taking a look at your code to see what the problem could be.

Regards

I can see something wrong in the call to the monthly exports:

The :id is expected to be a monthly export id, not a well id:


See more details: ComboCurve REST API

As it mentions you have to create the monthly export first, using this method: ComboCurve REST API

That wouldn’t explain the authentication error you got though. I can not tell yet why you got that error, it seems you are using get_auth_headers correctly. But you can try fixing that :point_up: first and we’ll see from there.

Also, since your helpers is handling the pagination, you don’t need to manually include skip param in url.

Regards

2 Likes