Documentation Improvement - Add more code examples

Hi,

While looking at  Requests’ [Documentation](https://requests.readthedocs.io/en/latest/), I noticed that some APIs do not have code examples.

Specifically, I found that out of the 89 API methods that appear in the documentation, 68 methods do not have code examples. Looking at Stack Overflow, I see that there are several questions regarding those methods, which suggests that adding code examples for them might be useful. 

For example:
- The method _**requests.Session.close**_ has no examples in the documentation, but there are 10 questions in stackoverflow regarding this method. [Here](https://stackoverflow.com/questions/49253246/how-to-close-requests-session) is an example.

- The method _**requests.cookies.RequestsCookieJar.set**_ has no examples in the documentation, but there are several questions in stackoverflow regarding this method. [Here](https://stackoverflow.com/questions/75514573/where-can-i-find-python-requests-library-functions-kwargs-parameters-documente) is an example.

Do you agree that adding code examples for these methods can improve requests’ documentation? If yes, would you like me to create a PR updating the documentation?

Note that I got the above results from our [documentation quality analysis tool](https://github.com/ualberta-smr/DocumentationQuality), which analyzes a library's documentation and source code to determine the documentation quality. We developed this tool at the University of Alberta as part of our research on assessing documentation quality.

Requests version used: v2.31.0.


> * The method _**requests.Session.close**_ has no examples in the documentation, but there are 10 questions in stackoverflow regarding this method. [Here](https://stackoverflow.com/questions/49253246/how-to-close-requests-session) is an example.

The existence of questions does not imply the need for a code example. For this one in particular, what kind of example do you think would be useful here?

> * The method _**requests.cookies.RequestsCookieJar.set**_ has no examples in the documentation, but there are several questions in stackoverflow regarding this method. [Here](https://stackoverflow.com/questions/75514573/where-can-i-find-python-requests-library-functions-kwargs-parameters-documente) is an example.

Again, an example here would look like what? This isn't users should be using often if at all. So what code example would be useful?

---

StackOverflow is full of people doing things they shouldn't with this library's internals. That doesn't mean we should add documentation to help them do things that 99.9% of the time they don't need to care about.

Closing since the has been no response

Apologies for the late response, as I was investigating the problem with Session.close below. 

> > * The method _**requests.Session.close**_ has no examples in the documentation, but there are 10 questions in stackoverflow regarding this method. [Here](https://stackoverflow.com/questions/49253246/how-to-close-requests-session) is an example.
> 
> The existence of questions does not imply the need for a code example. For this one in particular, what kind of example do you think would be useful here?
> 
The primary intuition of a developer would be that once a session has been closed, it is unusable. (For example, while working with a file.) But it seems like for Session.close it is not the same. 

So, for this particular case, an example that shows that a Session object can still be used after closing would be useful. Also, if we look at the number of views of this question (17K views), it shows that many developers might be facing the same issue, and having a code example (or clarification) in the documentation might be useful.


However, I am not sure if this is the expected behavior or a bug because a part of the doc says, 

> ```
> with requests.Session() as s:
>      s.get('https://httpbin.org/cookies/set/sessioncookie/123456789')
> ```
>  
> This will make sure the session is closed as soon as the with block is exited, even if unhandled exceptions occurred.

 

But when I tried the example code below, it showed that the session was still not closed.

```
userName = {'username': 'JohnDoe'}
location = {'location': 'XYZ'}

setCookieUrl = 'https://httpbin.org/cookies/set'
getCookieUrl = 'https://httpbin.org/cookies'

with requests.Session() as s:
    s.get(setCookieUrl, params=userName)
    s.get(setCookieUrl, params=location)
    r = s.get(getCookieUrl)
    print(r.text)  # Prints the cookies


r2 = s.get(getCookieUrl)
print(r2.text)  # Still prints the same cookies
```
Thus, the expected behavior should be misleading. This could be fixed by updating the quoted documentation sentence above and/or adding an illustrative code example about expected behavior.

> > * The method _**requests.cookies.RequestsCookieJar.set**_ has no examples in the documentation, but there are several questions in stackoverflow regarding this method. [Here](https://stackoverflow.com/questions/75514573/where-can-i-find-python-requests-library-functions-kwargs-parameters-documente) is an example.
> 
> Again, an example here would look like what? This isn't users should be using often if at all. So what code example would be useful?
> 

> StackOverflow is full of people doing things they shouldn't with this library's internals. That doesn't mean we should add documentation to help them do things that 99.9% of the time they don't need to care about.

I agree with you that this method might not be used that often. 

My intuition was that since this is a method that appears in the API reference documentation (rather than one that only appears in the source code), then we can expect that users will end up using it -- even if they should not. However, as you said, not every method deserves an example. Thus, my goal was to prioritize which methods need code examples (or clarifications) by looking at which ones users struggle with on Stack Overflow. I would love to hear your opinion on other prioritization mechanisms that make more sense to you.