Spaces:
Running
Running
File size: 1,072 Bytes
eba98a5 100d5f6 eba98a5 cbfc36f 100d5f6 cbfc36f eba98a5 cbfc36f eba98a5 |
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 |
import requests
import fn
def upload(img_path, member):
member = fn.transform_number(member)
url = "https://api.cosmo.fans/rekord/v1/post/"
headers = {
"accept": "application/json, text/plain, */*",
"authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoiYWNjZXNzIiwiaWF0IjoxNzE2MTQyMTU0LCJleHAiOjE3MTY3NDY5NTQsInN1YiI6IjE0MzMxMCJ9.cO2BTL-p4glxxpH84Kb2vFc3xTiJHBJql_ZNDyBMXlg",
"appversion": "2.7.8",
"accept-language": "ko-KR,ko;q=0.9",
"accept-encoding": "gzip, deflate, br",
"x-request-id": "246cc82d-889a-461a-a6ea-74bda45fdf72",
"deviceid": "iPad12,1",
"user-agent": "cosmo/78 CFNetwork/1494.0.7 Darwin/23.4.0",
}
# Multipart form data
data = {
"artistMemberIds": member,
"tagId": "4"
}
files = {
"file": ("6F98DCF5-060A-449E-BBE0-F4A3ECD80C77.png", open(img_path, "rb"), "image/png"),
}
response = requests.post(url, headers=headers, data=data, files=files)
return f"{response.status_code}\n{response.text}"
|