0

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.

1
  • @Lewis I thought so, but then again I couldn't find any mention in the documentation. Could you help me point it out, if you are able to? Commented Feb 13 at 15:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.