-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathmain.py
37 lines (29 loc) · 1012 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from lib import alibaba, yiwugo
from lib.ali1688 import ali1688
from lib.world_taobao.world_taobao import WorldTaobao
if __name__ == "__main__":
path = "data/down.jpeg"
upload = ali1688.Ali1688Upload()
res = upload.upload(filename=path)
print(res.json())
image_id = res.json().get("data", {}).get("imageId", "")
if not image_id:
raise Exception("not image id")
print(upload.image_search_url(image_id=image_id))
taobao_upload = WorldTaobao()
res = taobao_upload.upload(filename=path)
if res.json().get("data"):
print("taobao_upload success")
# alibaba example
upload = alibaba.Upload()
image_key = upload.upload(filename=path)
print(f"{image_key}")
image_searh = alibaba.ImageSearch()
req = image_searh.search(image_key=image_key)
print(req.url)
# # yiwugo
yiwugo = yiwugo.YiWuGo()
res = yiwugo.upload(path)
assert "起购" in res.text, "yiwugo search error"