Skip to content

Commit cf143be

Browse files
committed
Add search post method
1 parent 82efca7 commit cf143be

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

loading_api_wrapper/api.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,19 @@ def get_profile(self):
4646
}
4747

4848
return response.json()
49+
50+
def search(self, query):
51+
url = f"{API_URL}/{API_VERSION}/search/"
52+
headers = {
53+
"User-Agent": USER_AGENT,
54+
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
55+
}
56+
response = requests.post(url, headers=headers, data={"query": query})
57+
58+
if response.status_code == 200:
59+
return {
60+
"code": response.status_code,
61+
"search_results": response.json(),
62+
}
63+
64+
return response.json()

0 commit comments

Comments
 (0)