Python API 404 Errors

I am using the Airtable Python API

With the following code I get a successful response, minus the API key I removed.

*from airtable import Airtable*
  • import os*

  • table_name = ‘PeachTree 903’;*

  • base_key = ‘app9F0yiPo2kvFBsA’;*

  • api_key = ‘’;*

  • airtable = Airtable(base_key, table_name, api_key)*

  • print(airtable)*

The response I get from the above is:
image

Which matches my table_name.

Now when I go to add this next line and run the script I get the following errors like nothing is returned which does not make any sense.

airtable.get_all()

Anyone solve this?

Hi James, and welcome to the community!

I see a few issues, but I can’t be certain because the actual code you are running is not visible here, right? You should share the actual code (without API key) so we can see exactly what’s running.

One issue is the fact that the table name includes a space. The only way for this to work is if the table name is URI encoded. Failing to do so would cause the exact issue I see in the screen shot.

Code:

I did remove api key. I also took your advice and removed the space from the table name.

PS I did place code in original post, but looks like formatting got messed up and confusing.

Pretty sure that’s not the code that you used to get this response because it returned an object and did so without URI encoding of the table name? Very hard to believe; it should have thrown an error as it seems to be doing now.

image

Did you also remove the space from the table name in Airtable? And what was the outcome?

If you URI encode the table name, you don’t need to remove spaces.

I was calling the base name, not the table name. That is what thru the error in the code. Everything is working now.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.