Skip to content

Commit

Permalink
Replace use of requests in examples with httpx (#190)
Browse files Browse the repository at this point in the history
Fixes #177
  • Loading branch information
vrslev committed Apr 3, 2023
1 parent 4fe3c04 commit b3ae8d1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/sansio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ This module provides functions to help in the construction of a URL request
by helping to automate the GitHub-specific aspects of a REST call.
::

import requests
import httpx

request_headers = create_headers("brettcannon", oauth_token=auth)
url = "https://api.github.com/repos/brettcannon/gidgethub/issues/1"
response = requests.get(url, headers=request_headers)
response = httpx.get(url, headers=request_headers)

.. function:: accept_format(*, version="v3", media=None, json=True)

Expand Down Expand Up @@ -160,7 +160,7 @@ Responses
Decipher a response from the GitHub API gather together all of the details
that are provided to you. Continuing from the example in the Requests_ section::

# Assuming `response` contains a requests.Response object.
# Assuming `response` contains a httpx.Response object.
import datetime


Expand All @@ -174,7 +174,7 @@ that are provided to you. Continuing from the example in the Requests_ section::
now = datetime.datetime.now(datetime.tzinfo.utc)
wait = rate.reset_datetime - now
time.sleep(wait.total_seconds())
response_more = requests.get(more, headers=request_headers)
response_more = httpx.get(more, headers=request_headers)
# Decipher `response_more` ...

.. class:: RateLimit(*, limit, remaining, reset_epoch)
Expand Down Expand Up @@ -256,7 +256,7 @@ Utilities

Enterprise GitHub users can specify their custom base URL in *base_url*.
By default, https://api.github.com/ is used as the base URL.

.. versionchanged:: 4.0

Added ``base_url`` argument.

0 comments on commit b3ae8d1

Please sign in to comment.