Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to do an ean query?
#1
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
Reply
#2
What have you tried? It looks like a request header you could send with a HTTP request.
Reply
#3
(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.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020