Skip to content

Instantly share code, notes, and snippets.

@footcarts
Last active March 6, 2018 01:29
Show Gist options
  • Save footcarts/60244a32598382b235549bd755f6f680 to your computer and use it in GitHub Desktop.
Save footcarts/60244a32598382b235549bd755f6f680 to your computer and use it in GitHub Desktop.
$$ in gross GOAT sales after fees including cashout
import requests
from bs4 import BeautifulSoup
import json
import time
from time import sleep
import urllib
username ='USERNAME'
password = 'PASSWORD'
headers = {
'accept': '*/*',
'content-type': 'application/x-www-form-urlencoded',
'accept-encoding': 'br, gzip, deflate',
'user-agent': 'GOAT/1.15 (iPhone; iOS 11.1.1; Scale/2.00)',
'accept-language': 'en-US;q=1, hi-US;q=0.9, he-US;q=0.8, zh-Hans-US;q=0.7, fr-FR;q=0.6, ar-US;q=0.5',
'content-length': '68',
}
goat= requests.Session()
data = 'user%5Blogin%5D='+str(urllib.quote_plus(username))+'&user%5Bpassword%5D='+str(urllib.quote_plus(password))
login = goat.post('https://www.goat.com/api/v1/users/sign_in', headers=headers, data=data)
t = json.loads(login.text)
token = t['authToken']
token = 'Token token="' + str(token) + '"'
headers = {
'accept': '*/*',
'content-type': 'application/x-www-form-urlencoded',
'user-agent': 'GOAT/1.15 (iPhone; iOS 11.1.1; Scale/2.00)',
'accept-language': 'en-US;q=1, hi-US;q=0.9, he-US;q=0.8, zh-Hans-US;q=0.7, fr-FR;q=0.6, ar-US;q=0.5',
'accept-encoding': 'br, gzip, deflate',
'cookie': '__cfduid=da7481534ed91a847e963f816a9f3779a1501848993',
'Authorization': token,
}
cookies = {
'cookie: rCookie': 'qjjt79kjpftpf8gd59q7z',
}
price = 0
years = []
sold = []
for i in range(1,9999):
prices = price
response = requests.get('https://www.goat.com/api/v1/credits?page='+str(i), headers=headers, cookies=cookies)
c = json.loads(response.text)
try:
for p in c['credits']:
try:
y = p['orderNumber']
amount = p['amountCents']
year = p['createdAt']
year = year[:4]
years.append(year)
sold.append([year,amount])
price = price + amount
except Exception:
pass
except Exception:
print "Exception"
quit()
if prices == price:
price= (float(price)/100)
more_fee = price*.029
years_set= list(set(years))
for a in years_set:
price_year=0
counter = 0
for c in sold:
if a == c[0]:
price_year= price_year + int(str(c[1]))
counter = counter + 1
new_price_year= (float(price_year)/100)
more_fee_yearly = new_price_year*.029
print ("Amount made on goat in "+str(a)+" with "+str(counter)+" sales: $"+str(float(new_price_year-more_fee_yearly)))
print ("Amount made on goat total: $"+str(float(price-more_fee)))
quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment