-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
19 additions
and
49 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
import urllib | |||
import json | |||
|
|||
# Inheritable class to perform requests to generic APIs. | |||
class BaseAPIRequest: | |||
def __init__(self, url): | |||
self.url = url | |||
|
|||
#Inherit this method to describe how to format URLs. | |||
def format_url(self): | |||
pass | |||
|
|||
# Requests the API and returns the JSON object. | |||
def request(self, **args): | |||
self.format_url(**args) | |||
object = json.loads("".join([l for l in urllib.urlopen(self.url)])) | |||
return object |
Binary file not shown.