~/talk

A Lazy Person's Guide to Building REST Clients or: How I Learned to Stop Worrying and Love Dunder Ov

Talkat PyCon AU 2024 · 2024-11-22..11-26· [python]
name:Ash Bek
links:none on file
slides:none on file

Prototype overrides Python dunders to generate endpoints on demand: overrode __getattribute__ and __getattr__ and made instances callable via __call__, so attribute access like ip_addresses() formats a VirusTotal URL and issues a request with the requests library. The result is an endpoint class of about 80–100 lines that works, but requires fixes (double-creation bugs, returning JSON vs object, breaking instantiation if super is omitted). Notes use Python 3.10 pattern matching and caution that OpenAPI generators exist but can be unreliable.

AI-written summary · about

  1. 0:00Introduction
  2. 1:08REST clients are boring
  3. 4:56Problem case and approach
  4. 7:04Python’s dunder methods
  5. 9:10Dynamic attributes and methods
  6. 12:47Objects as callables
  7. 15:37REST client prototype
  8. 17:24Expanding functionality
  9. 19:11Validation and response handling
  10. 21:39Next steps and questions
  11. 22:22Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.