Python Forum

Full Version: How to do an ean query?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I want to program an ean query with an ean api.
The ean request looks like this: Request

How can I do it.
I already tried some things but that attemps did not work.

Thanks in advance and have a great day.

Best regards
Leon
What have you tried? It looks like a request header you could send with a HTTP request.
(Jul-08-2020, 05:08 PM)stullis Wrote: [ -> ]What have you tried? It looks like a request header you could send with a HTTP request.

I have tried that:

import urllib3
http = urllib3.PoolManager()
ean = int(input("Enter EAN: "))
url = "http://opengtindb.org/?ean={}&cmd=query&queryid=400000000".format(ean)
response = http.request('GET', url)
When I enter print(response.data) I get the output but I don't know how to just show some of the variables.