gtalarico / pyairtable

Python Api Client for Airtable
https://pyairtable.readthedocs.io
MIT License
786 stars 139 forks source link

Fix regression introduced by `endpoint_url=` #246

Closed mesozoic closed 1 year ago

mesozoic commented 1 year ago

As @goksan pointed out here, there is untested behavior that regressed in my previous commit (0189d9d). When calling api.get_base() we need to ensure the version number does not get appended to the URL twice.

Rather than second-guessing and modifying constructor arguments, I introduced ApiAbstract.build_url() that inserts the correct version number in front of whatever URL components the caller needs to access. I've added tests to check that .get_table() doesn't wind up with /v0/v0 in the URL again.

(I'm planning to merge this immediately but I'm creating a PR for the paper trail.)

codecov-commenter commented 1 year ago

Codecov Report

Merging #246 (4c7b01b) into main (0189d9d) will increase coverage by 0.13%. The diff coverage is 71.42%.

@@            Coverage Diff             @@
##             main     #246      +/-   ##
==========================================
+ Coverage   87.36%   87.50%   +0.13%     
==========================================
  Files          14       14              
  Lines         641      640       -1     
==========================================
  Hits          560      560              
+ Misses         81       80       -1     
Impacted Files Coverage Δ
pyairtable/api/table.py 100.00% <ø> (ø)
pyairtable/metadata.py 35.71% <0.00%> (-4.29%) :arrow_down:
pyairtable/api/abstract.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes