Pretend You're Xyzzy bulk uploader.
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
import requests, csv, time | |
def main(): | |
print("Cards Against Uploader") | |
with open("inp.csv", "r") as file: | |
file = csv.reader(file, delimiter=',') | |
for row in file: | |
if row[0] is not "color": | |
upload(row[0], row[1], "NYA", row[3], row[2]) | |
time.sleep(7) | |
def upload(color, text, watermark, pick, draw): | |
url = 'https://example.com' | |
headers = { | |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0', | |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', | |
'Accept-Language': 'en-US,en;q=0.5', | |
'Content-Type': 'application/x-www-form-urlencoded', | |
'Origin': url, | |
'DNT': '1', | |
'Connection': 'keep-alive', | |
'Referer': url + '/addcard.jsp', | |
} | |
data = { | |
'color': color, | |
'text': text, | |
'watermark': watermark, | |
'pick': pick, | |
'draw': draw | |
} | |
response = requests.post(url + '/addcard.jsp', headers=headers, data=data) | |
print() | |
print("POSTed: " + text + " [" + str(response.status_code) + "]") | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment