Skip to content

Instantly share code, notes, and snippets.

@ewancook
Last active March 2, 2017 19:46
Show Gist options
  • Save ewancook/1c21cfe1a773211095f2 to your computer and use it in GitHub Desktop.
Save ewancook/1c21cfe1a773211095f2 to your computer and use it in GitHub Desktop.
A short autobumping script for tf2outpost.com
import threading
import time
import random
from datetime import datetime
import requests
# The user hash can be found by viewing the source of any tf2outpost.com page whilst logged in.
# It will change upon logging in or out.
# The trade id can be found in the URL of the trade page.
user_hash = ""
trade_id = 0
URL = "http://www.tf2outpost.com/api/core"
cookies = dict(uhash=user_hash)
payload = dict(action="trade.bump", hash=user_hash, tradeid=trade_id)
code_messages = {200: "Trade successfully bumped",
301: "You can't bump a non-existent trade.",
302: "You do not own this trade.",
303: "You cannot bump this trade yet.",
401: "You are not logged in.",
402: "Action not specified.",
403: "Invalid hash specified."
}
def worker():
threading.Timer(random.randint(1800, 2700), worker).start()
r = requests.post(URL, data=payload, cookies=cookies)
code = r.json()["meta"]["code"]
print "({}) Status: {}. [{}]".format(str(datetime.now()), r.status_code, code_messages[code])
worker()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment