[Tutor] DEALING WITH API

Alan Gauld alan.gauld at btinternet.com
Fri Aug 7 19:55:50 CEST 2015


On 07/08/15 10:14, Gaurav Lathwal wrote:

> This time I am trying to fetch the required data using the API of the
> website.

Which website? Don;t assume we can remember from your previous post
or that we will want to go trawling the archives.

The easier you make it for us to answer the more likely you are
to get good answers.

> But, the problem I am having is I don't know how to make the request
> properly.
> When I enter the required URL in my browser, it downloads a .tgz which
> includes all the updates that have taken place on the website in the last
> 24 hours.

Can we see exactly what URLyou type in?

> So, when I use urlopen on the same url, & I try to read it, all I get is
> gibberish.

Can you show us the actual code and the actual gibberish.
Are you sure the gibberish is not just the tgz binary file
contents? And if so why are you sure?
ie. What did you do to test it?

The more detailed facts we have the more we can help.
code, error messages, python version, OS, -  all help.

> If I am unable to solve this problem, I am quitting programming, I have had
> enough bad experiences. :\ :\

One thing I've learned about programming over the last 40 years
is that you always have to go through a lot of trial and error to
get new stuff working. Think of it as experimenting and having
fun discovering new things and it becomes less painful.
Think of it as just inconvenient errors and its just
frustrating... It's all about the state of mind :-)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list