-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix make_http_request #20
Fix make_http_request #20
Conversation
Will this align with USEPA/flowsa#144, meaning, should flowsa just use the esupy function here? I haven't yet looked closely but its possible that the original flowsa function existed before esupy so we can probably consolidate there now. |
The flowsa function includes a couple of lines to deal with websites that require cookies. It would be easy to add those lines to the |
@catherinebirney please weigh in on this |
@matthewlchambers yes I think you can go ahead and make that change here, add that set_cookies parameter the same as used in flowsa than we can drop that function in flowsa and use this one instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment above
Ok, I've added the cookie handling code to the esupy function. Before removing the flowsa.common function, do you want me to add the new JobLib related code (that just recently got added to the flowsa.common function as decoration) to the esupy function as well? |
Actually, I was wondering about that JobLib caching anyway; it doesn't seem like we should be calling the exact same url very often. Unless this happens in connection with a data source I'm not familiar with yet? |
I was just looking to see if we can cache a function call from another package, that is, maintain the JobLib memory caching only for flowsa. I'm not sure we want to always cache these across the tool ecosystem. I suppose in flowsa we could create a pass through function that has the cache. |
Can you point me to the use case that prompted implementing caching? Also, I wonder if we should be using a caching method specifically intended for caching http requests, such as that found in the package requests-cache, rather than JobLib. |
In any case, we can certainly implement a pass-through function in flowsa that caches using JobLib if that's desired. |
Let's discuss further when @catherinebirney returns next week. She was the one who implemented the caching so I don't want to speak for her. If i recall it was suggested by one of the package reviewers |
I agree with dropping make_url_request() from flowsa and calling on the esupy function. I've thought about the JobLib caching as well - it is helpful for developers for testing purposes, but outside of testing, JobLib is not overly useful because as @matthewlchambers points out, the same urls are not called often. I'm open to dropping JobLib from the repo and I'll continue to use caching locally |
merging in to esupy, @catherinebirney @matthewlchambers i'll let you all decide on what you'd like to do about the caching in flowsa and what other updates are needed there to transition to using this function. |
@catherinebirney , I'll go ahead then and submit a pull request removing the JobLib caching and replacing the |
Improved control flow and robustness of
make_http_request
, and renamed it asmake_url_request
to reflect the fact that it can make FTP requests as well. I also providedmake_http_request
as an alias formake_url_request
, with a logged deprecation warning, sincestewi
imports and usesmake_http_request
from this package(I've also submitted a PR onstewi
to change the name).