HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
gabrielsroka
r
Python2022–2025
gabrielsroka / r

r

a small subset of Python Requests

2Distinct people
7Mentions
0Explicit recommenders
7GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

a small subset of Python Requests

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year7 dated mentions

Observed mentions: 2022-01-31 23:44:46 UTC to 2025-03-28 16:00:24 UTC.

012342022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 4 mentions; 2 submissions, 2 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20232024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC422
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC000
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC211
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC101

What Hacker News says

7 sources
Clickable links https://github.com/gabrielsroka/r https://docs.python.org/3/library/urllib.request.html https://docs.python.org/3/library/http.client.html A more complete example: import http.client import urllib.parse import json as _json import re import time # Set these: host = 'example.okta.com' token = ....' conn = http.client.HTTPSConnection(host) headers = {'authorization': 'SSWS ' + token} def main(): res = get('/api/v1/users/me') me = res.json user_id = me['id'] print(me['id']) start = time.time() for user in get_objects('/api/v1/users', filter='profile.lastName eq "Doe"', limit=2): print(user['id']) end = time.time() print(f'{end - start:5.1f} sec (http.client)') # Update a user. # res =
Read the rest
post('/api/v1/users/' + user_id, {'profile': {'title': 'admin'}}) # me = res.json # print(me['profile']['title'], res.headers['x-rate-limit-remaining']) def rh(method, url, json=None): _headers = headers.copy() if json: body = _json.dumps(json, separators=(',', ':')).encode() _headers['Content-Type'] = 'application/json' else: body = None conn.request(method, url, body, _headers) res = conn.getresponse() if res.reason != 'No Content': res.json = _json.load(res) return res def get_objects(url, **fields): if fields: url += '?' + urllib.parse.urlencode(fields) while url: res = get(url) for o in res.json: yield o links = [link for link in res.headers.get_all('link') if 'rel="next"' in link] url = re.search('<https://[^/]+(.+)>', links[0]).group(1) if links else None def get(url): return rh('GET', url) def post(url, json=None): return rh('POST', url, json) main()
In Show HN: R.py, a small subset of Python Requests

Show HN: R.py, a small subset of Python Requests

i revisited the work that i started in 2022 re: writing a subset of Requests but using the standard library: https://github.com/gabrielsroka/r back then, i tried using urllib.request (from the standard library, not urllib3) but it lacks what Requests/urllib3 has -- connection pools and keep alive [or that's where i thought the magic was] -- so my code ran much slower. it turns out that urllib.request uses http.client, but it closes the connection. so by using http.client directly, i can keep the connection open [that's where the real magic is]. now my code runs as fast as Requests/urllib3, but in 5 lines of code instead of 4,000-15,000+ moral of the story: RTFM over and over and over again. """Fetch users from the Okta API and paginate.""" import http.client import json import re import urllib.parse # Set these: host =
Read the rest
'domain.okta.com' token = 'xxx' url = '/api/v1/users?' + urllib.parse.urlencode({'filter': 'profile.lastName eq "Doe"'}) headers = {'authorization': 'SSWS ' + token} conn = http.client.HTTPSConnection(host) while url: conn.request('GET', url, headers=headers) res = conn.getresponse() for user in json.load(res): print(user['id']) links = [link for link in res.headers.get_all('link') if 'rel="next"' in link] url = re.search('<https://[^/]+(.+)>', links[0]).group(1) if links else None https://docs.python.org/3/library/urllib.request.html https://docs.python.org/3/library/http.client.html
3 points · Open discussion

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.