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

use requests library? #181

Closed
imnotjames opened this issue Aug 9, 2018 · 8 comments
Closed

use requests library? #181

imnotjames opened this issue Aug 9, 2018 · 8 comments

Comments

@imnotjames
Copy link
Contributor

imnotjames commented Aug 9, 2018

Instead of using open, and the util.http module for handling HTTP requests, would there be interest in converting this over to using the requests library? It means a more generalized library with more control over the workflow.

If so, we could utilize requests-mock to create mocks more easily for tests for the plugins.

A branch using requests in the util.http can be found here https://github.com/imnotjames/skybot/tree/feature/use-requests-for-http but I think there's a benefit in handling everything with requests directly.

Thoughts, concerns, etc?

@Red-M
Copy link

Red-M commented Aug 9, 2018 via email

@imnotjames
Copy link
Contributor Author

What do you mean by an opt-in style of implementation? Leaving everything in the util.http alone and migrating all of the existing plugins over?

@Red-M
Copy link

Red-M commented Aug 9, 2018 via email

@imnotjames
Copy link
Contributor Author

Hmm.. well, I don't really see anyone would start using requests at that point - since it just means keeping up two paths rather than one. Instead of simplifying development, it complicates it.

If that's the only path forward, I don't think it makes sense to go with requests in that case.

@Red-M
Copy link

Red-M commented Aug 9, 2018 via email

@imnotjames
Copy link
Contributor Author

imnotjames commented Aug 9, 2018 via email

@Red-M
Copy link

Red-M commented Aug 9, 2018 via email

@imnotjames
Copy link
Contributor Author

Right - I did that in util.http while updating the requirements.txt, and in another fork I've gone ahead and updated some if the built in plugins, which spurred my opening of this issue.

I think that as an added benefit, other bots would be less tied to skybot-specific code if they wanted to use the plugins system. They'd just need to install requests, which is a bit more standard of a library than util.http. I don't think that's more of a problem than knowing you need to manually copy over util.http and keep that up to date with the skybot version.

I'll research how we can mock the urllib HTTP. Maybe that would be a better place to start so we can get tests in place to verify we aren't causing breakage within the plugins of we were to make a change like this.

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

No branches or pull requests

2 participants