Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record based on parameter hashing #78

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

RyanJarv
Copy link

Summary

This changes the save/load behavior from incrementing on each call to hashing the parameters and body in the API request.

So if the same request is sent and we receive different parameters it should overwrite the previous response. The exception to this is if the api call is paginated, in which case we should increment the index counter rather then overwriting.

Related

TODO

  • Testing with paginated API's

This changes the save/load behavior from incrementing on each call
to hashing the parameters and body in the API request.

So if the same request is sent and we recieve different parameters
it should overwrite the previous response. The exception to this
is if the api call is paginated, in which case we should increment
the index counter rather then overwriting.

Behavior on pagination vs incrementing still needs testing.
@codecov-io
Copy link

codecov-io commented Dec 20, 2020

Codecov Report

❗ No coverage uploaded for pull request base (develop@1e8ab91). Click here to learn what that means.
The diff coverage is 98.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop      #78   +/-   ##
==========================================
  Coverage           ?   90.10%           
==========================================
  Files              ?        4           
  Lines              ?      293           
  Branches           ?        0           
==========================================
  Hits               ?      264           
  Misses             ?       29           
  Partials           ?        0           
Impacted Files Coverage Δ
placebo/pill.py 91.84% <98.55%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e8ab91...6a4e459. Read the comment docs.

@RyanJarv
Copy link
Author

Just FYI, I might need to hard fork this soon. My use is fairly different from how this project is intended to be used, will see how it goes though.

Wanted to at least open this PR in case other people find it useful.

boto3 doesn't support this but we can short circuit in the hooks
to get the same behavior.
So far it seems simply including it in the hash works so far.
I believe this will break some cases, think it's worth it to
just sort those out as they come up since this simplifies
the code quite a bit.
@RyanJarv
Copy link
Author

RyanJarv commented Dec 22, 2020

Removing pagination support for now since this was buggy. The API's I've been testing so far don't use random markers so just including them in the hash work's out ok. Will see if I run into any issues here.

@RyanJarv RyanJarv changed the title [WIP] Record based on parameter hashing Record based on parameter hashing Apr 29, 2021
@RyanJarv
Copy link
Author

RyanJarv commented Apr 29, 2021

Just realized I never removed the WIP label. I believe this is working.. I haven't used this in a bit though and don't have a need for it anymore.

Mentioned this above but will leave this open in case it's useful to anyone, otherwise can just be closed.

Edit: Well.. I guess works, without pagination. Or something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants