Skip to content
Snippets Groups Projects
Commit 1f6d908d authored by zshan2's avatar zshan2
Browse files

try to recover assignment-2.1 branch

parent 0b872741
Branches assignment-2.1
No related tags found
1 merge request!2Implementation of assignment-2.2
......@@ -5,6 +5,7 @@ from dotenv import load_dotenv
def safe_url(query):
""" convert query to URL-safe style """
load_dotenv()
host = os.getenv('SERVER_HOST')
return host + Parser.url_safe(query)
......@@ -24,6 +25,7 @@ def get(query):
def put(query, json_file):
""" PUT request """
print("PUT: " + query)
url = safe_url(query)
req = requests.put(url, json=json_file)
......@@ -32,6 +34,7 @@ def put(query, json_file):
def post(query, json_file):
""" POST request """
print("POST: " + query)
url = safe_url(query)
req = requests.post(url, json=json_file)
......@@ -40,6 +43,7 @@ def post(query, json_file):
def delete(query):
""" DELETE request """
print("DELETE: " + query)
url = safe_url(query)
req = requests.delete(url)
......
......@@ -4,6 +4,7 @@ from DataBase import mongoDB as db
def scrape_api(url_api, book_num_api, author_num_api):
""" Function called by other module to run the scraper """
print('Request received, start scraping')
book_dict_api = {}
author_dict_api = {}
......
def parse_book_dict_to_json(dictionary):
""" parse books dictionary to json file """
item_list = list(dictionary.items())
return_list = []
for items in item_list:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment