Lurker News
Effortlessly discover API behaviour with a Chrome extension that automatically generates OpenAPI specifications in real time for any app or website.

Comments (102) 40 threads

the_absurdist1 reply#
I wish this would document the auth headers.

What would be particularly useful is if it saved token values and then (through search) joined them on the response of the auth call to get the initial token.
That way you could easily determine what auth call was needed to get you a token to use the endpoint.

mrmagoo22 replies#
Great suggestion, I will look into this.
hoerzu#
I have used llama to figure out the duplications / pathparamters :)
truemotive#
You… you built the thing I’ve been spending 3 days looking for… oh man
ttul1 reply#
This is super cool. Writing code to drop into the JavaScript console lets you do insane things. I’ve found great success using ChatGPT to help me write the code, which I then just cut and paste into the console. Asking it to “make it all run in parallel using async/await” will massively speed up execution of serial tasks.

For instance, I had GPT help me write browser JS that groks literally thousands of IP addresses in an open security tool that shall not be named. I can vacuum much of their entire database in seconds by making hundreds of async calls. While they do have bot protection on the website, they appear to have no protection at all on their browser APIs once the user has been given a cookie… I suspect this is common.

jhardy542 replies#
This is about OpenAPI (Swagger), not OpenAI (ChatGPT).
ttul#
I know.
cxr#
This is an extension for Chrome, not Safari.
lucasyvas#
This would be excellent
mrmagoo2#
Hey absolutely please do, thank you!
parhamn1 reply#
Are devtools extensions/panels standardized?
distortedsignal#
I'd love to see FF support on this.
mrmagoo21 reply#
As a follow up, the algorithm that powers this makes use of the chrome.devtools.network API. Specifically it passes the Request object that is in the HAR 1.2 archive format.

So if you can pass the equivalent of that in Firefox/other browsers to the insert method and switch things up a bit, it should be relatively straightforward. I will think about pulling out the core logic into its own lib.
https://developer.chrome.com/docs/extensions/reference/devto...
https://developer.chrome.com/docs/extensions/reference/devto...
https://github.com/AndrewWalsh/openapi-devtools/blob/main/sr...

a_c#
Also the polyfill has a promise based API rather than a callback, which I don't yet know if there is a workaround
archiewood7 replies#
My most common use case here is to then want to hit the API from python, and adjust the params / url etc.

Would love a "copy to python requests" button that
grabs the headers
generates a boilerplate python snippet including the headers and the URL:

    import requests
    import json

    url = ''

    headers = {
        'User-Agent': 'Mozilla/5.0 ...',
        ...
    }

    data = {
        "page": 5,
        "size": 28
        ...
    }

    response = requests.post(url, headers=headers, data=json.dumps(data))

    if response.status_code == 200:
        print(response.json())
    else:
        print(f"Error {response.status_code}: {response.text}")
ea0164 replies#
Steps to do so:

- open the network console
- right click on the request
- click "copy as curl"
- visit https://curlconverter.com/ to convert to Python/Node/any language

tilne#
Thank you for this. I didn’t know curlconverter existed.
MurageKabui#
I was to say this lol
archiewood1 reply#
This is my current workflow, though with ChatGPT.

I was just trying to save a few clicks

novia#
You made your request sound important to implement when you already have a workaround that doesn't take very much time...

This is why feature bloat is a thing

yread#
wow what a perfect service to steal session cookies
knowsuchagency#
You could take the OpenAPI json generated from this project and feed it to https://docs.scalar.com/swagger-editor which generates boilerplate in several formats, including Python
gabrielsroka#
1. You should almost always use requests.Session() instead of requests. It's faster, and can make the code shorter.

2. requests can dump to JSON for you by using json=, so you don't need a separate module. It'll even set the content-type header to application/json for you.

  import requests

  url = ''

  headers = {
      'User-Agent': 'Mozilla/5.0 ...',
      ...
  }

  session = requests.Session()
  session.headers.update(headers)

  data = {
      "page": 5,
      "size": 28
      ...
  }

  response = session.post(url, json=data)

  if response.status_code == 200:
      print(response.json())
  else:
      print(f"Error {response.status_code}: {response.text}")
westurner#
SeleniumIDE can record and save browser test cases to Python: https://github.com/SeleniumHQ/selenium-ide

awesome-test-automation/python-test-automation.md lists a number of ways to wrap selenium/webdriver and also playwright: https://github.com/atinfo/awesome-test-automation/blob/maste...
vcr.py, playback, and rr do [HTTP,] test recording and playback. httprunner can record and replay HAR. DevTools can save http requests and responses to HAR files.
awesome-web-archiving lists a number of tools that work with WARC; but only har2warc: https://github.com/iipc/awesome-web-archiving/blob/main/READ...

Load more comments