[Python] How to debug this Google Lens URL?

Discussão em 'Python' iniciado por Stack, Fevereiro 12, 2025.

  1. Stack

    Stack Membro Participativo

    I'm basically came across a code which used local images for Google lens search but I can't understand how the encdoded_image works or where did they get from?

    from requests import Session

    url = "https://lens.google.com"
    session = Session()
    multipart = {
    'encoded_image': ("boat.png", open("boat.png", 'rb')),
    }

    response = session.post(
    url + "/upload",
    files = multipart,
    allow_redirects = False
    )

    search_url = response.headers.get('Location')



    This is what I referred: https://github.com/krishna2206/google-lens-python/blob/master/googlelens/googlelens.py

    Can someone help me understand how to debug that in chrome or even launch it with cookies in a browser?

    I tried going over to chrome developer tools and it just shows data:image/jpeg;base64,/9j/4AAQ... a huge string of characters. This is the first mention of that file. I expected to see encoded_image somewhere buried.

    Continue reading...

Compartilhe esta Página