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

Cookbook ideas for reqwest crate #84

Closed
dtolnay opened this Issue May 16, 2017 · 8 comments

Comments

Projects
None yet
5 participants
@dtolnay
Member

dtolnay commented May 16, 2017

Come up with ideas for nice introductory examples of using reqwest, possibly in combination with other crates, that would be good to show in the Rust Cookbook. Please leave a comment here with your ideas! You don't necessarily have to write the example code yourself but PRs are always welcome!

Crate evaluation thread on internals.rust-lang.org

@budziq

This comment has been minimized.

Show comment
Hide comment
@budziq

budziq May 17, 2017

Collaborator

In addition to already created issues i would suggest:

  • using HEAD request to test endpoint/file existence (or just check headders)
  • use PUT / PATCH requests (GitHub has some apis like that) although it might be a little redundant
  • test if links on webpage are stale - html5ever or select

I guess that following might be out of scope and a little redundant:
Possibly just show some interesting web apis (twitter) but most of these would be to involved due to oAuth (or require very high level crate oauth-client )

  • Interact with twitter API - make a tweet
  • google translate
  • google geocoder / reverse geocoder
  • stack overflow
Collaborator

budziq commented May 17, 2017

In addition to already created issues i would suggest:

  • using HEAD request to test endpoint/file existence (or just check headders)
  • use PUT / PATCH requests (GitHub has some apis like that) although it might be a little redundant
  • test if links on webpage are stale - html5ever or select

I guess that following might be out of scope and a little redundant:
Possibly just show some interesting web apis (twitter) but most of these would be to involved due to oAuth (or require very high level crate oauth-client )

  • Interact with twitter API - make a tweet
  • google translate
  • google geocoder / reverse geocoder
  • stack overflow
@dtolnay

This comment has been minimized.

Show comment
Hide comment
@dtolnay

dtolnay May 17, 2017

Member

I am open to showing a variety of common interesting web APIs. OAuth is a little more involved than I would like for the cookbook. I would prefer to handle it by linking from the basic-auth GitHub example to the oauth-client documentation: #94.

Member

dtolnay commented May 17, 2017

I am open to showing a variety of common interesting web APIs. OAuth is a little more involved than I would like for the cookbook. I would prefer to handle it by linking from the basic-auth GitHub example to the oauth-client documentation: #94.

@budziq

This comment has been minimized.

Show comment
Hide comment
@budziq

budziq May 20, 2017

Collaborator
  • Make a partial download with range headers
Collaborator

budziq commented May 20, 2017

  • Make a partial download with range headers
@Michael-F-Bryan

This comment has been minimized.

Show comment
Hide comment
@Michael-F-Bryan

Michael-F-Bryan Jul 22, 2017

Contributor

This is a bit of a more advanced idea, but I recently wrote a wrapper around the github API for dealing with pagination by giving you an iterator which automatically requests the next page and deserializes it using serde.

Would something like that be a useful cookbook recipe, or is it too much of a niche problem?

Contributor

Michael-F-Bryan commented Jul 22, 2017

This is a bit of a more advanced idea, but I recently wrote a wrapper around the github API for dealing with pagination by giving you an iterator which automatically requests the next page and deserializes it using serde.

Would something like that be a useful cookbook recipe, or is it too much of a niche problem?

@budziq

This comment has been minimized.

Show comment
Hide comment
@budziq

budziq Jul 22, 2017

Collaborator

Hi @Michael-F-Bryan. Thanks for taking an interest!
We already have an example showing paginated response and we are trying to avoid pulling non LibzBlitz crates at the moment but you are welcome to submit your crate for inclusion in the official thread or contribute in any way such as:

  • to fix the existing example
  • implement new examples
  • propose new examples for any crate
  • improve cookbook in any way (including ui/ux)

We'd love to have you on board!

Collaborator

budziq commented Jul 22, 2017

Hi @Michael-F-Bryan. Thanks for taking an interest!
We already have an example showing paginated response and we are trying to avoid pulling non LibzBlitz crates at the moment but you are welcome to submit your crate for inclusion in the official thread or contribute in any way such as:

  • to fix the existing example
  • implement new examples
  • propose new examples for any crate
  • improve cookbook in any way (including ui/ux)

We'd love to have you on board!

@Michael-F-Bryan

This comment has been minimized.

Show comment
Hide comment
@Michael-F-Bryan

Michael-F-Bryan Jul 22, 2017

Contributor

Ah, looks like you guys are one step ahead of me! I was thinking you might be able to copy the guts out of my Pagination struct and adapt it to use reqwest instead of the github-rs client (which itself is just a thin wrapper around hyper). But you probably wouldn't gain much by altering the existing example to take inspiration from what I did other than showing how it's almost trivial to make the Pagination wrapper generic over anything which is deserializable using serde.

Contributor

Michael-F-Bryan commented Jul 22, 2017

Ah, looks like you guys are one step ahead of me! I was thinking you might be able to copy the guts out of my Pagination struct and adapt it to use reqwest instead of the github-rs client (which itself is just a thin wrapper around hyper). But you probably wouldn't gain much by altering the existing example to take inspiration from what I did other than showing how it's almost trivial to make the Pagination wrapper generic over anything which is deserializable using serde.

@fawix

This comment has been minimized.

Show comment
Hide comment
@fawix

fawix Dec 28, 2017

I like the pagination idea.
may I also suggest the different authentication methods as cookbook examples for reqwest?

  • Basic authentication
  • Basic hidden authentication
  • Digest authentication
  • Digest authentication with algorithm

we can use httpbin for those, as in this one for digest:
curl -vv --digest -k -u "user:pass" "https://httpbin.org/digest-auth/auth/user/pass/MD5

fawix commented Dec 28, 2017

I like the pagination idea.
may I also suggest the different authentication methods as cookbook examples for reqwest?

  • Basic authentication
  • Basic hidden authentication
  • Digest authentication
  • Digest authentication with algorithm

we can use httpbin for those, as in this one for digest:
curl -vv --digest -k -u "user:pass" "https://httpbin.org/digest-auth/auth/user/pass/MD5

@AndyGauge AndyGauge referenced this issue Apr 20, 2018

Closed

Tracking Issues #396

13 of 13 tasks complete

@budziq budziq removed this from the impl period milestone May 16, 2018

@AndyGauge AndyGauge referenced this issue Jul 18, 2018

Open

Recipe Series: Web Authentication #436

0 of 3 tasks complete
@AndyGauge

This comment has been minimized.

Show comment
Hide comment
@AndyGauge

AndyGauge Jul 18, 2018

Collaborator

Created remaining Reqwest recipes, closing tracking issue.

Collaborator

AndyGauge commented Jul 18, 2018

Created remaining Reqwest recipes, closing tracking issue.

@AndyGauge AndyGauge closed this Jul 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment