sczapuchlak / encyclopedia

0 stars 1 forks source link

Create API request Objects #24

Closed FreeMasen closed 6 years ago

FreeMasen commented 6 years ago

class Response():

class Tweet():

FreeMasen commented 6 years ago

Now that we have two API calls this needs to become a priority.

class Response():
  '''The result of an outbound request'''

class Result():
  '''A single entry in a response object'''

The reason this needs to become a priority is that we need to be able to gracefully handle the display of the data in the template. Now that we have a mixture of tweets and images, it is far more difficult to do this. I would be a good idea to unify the two api service calls into a singular request service.

def Requestor():
  def search_tweets(self, term):
    '''search for tweets on twitter'''
  def search_giphy(self, term):
    '''search for gifs on giphy'''

This would allow us to have one entry point for all searches. It also may be worth it to explore using a generic http request library and setting the correct headers for each of the services we add

watsonthecat commented 6 years ago

Moved the twitterAPI.py & giphyAPI.py into one file called: api.py

Will finish the wiki api and add that to api.py tonight/tomorrow

watsonthecat commented 6 years ago

Wiki Api is done! Lmk if you need api.py structured differently... I think it's how you wanted it