def main():
  tw = TradeWorker(Config().getData())
  print tw.get_item(19726).name
  try:
    print tw.get_item(19726).name
    
    print tw.get_items([19727, 19728])[0].name
    
    for item in tw.get_trends():
      print item.name
  except:
    print "server down"
Beispiel #2
0
from django.http import HttpResponse
import json
from gw2api.trade import TradeWorker
from gw2api.config import Config

print "login in progress"
tw = TradeWorker(Config().getData())
tw.force_login()
print "logged"

def get_trends(request):
	global tw
	objects = []

	for item in tw.get_trends():
		objects.append({
			'name': item.name,
			'url': item.icon,
			'description': ("Rarity: " + item.rarity)
		})

	return HttpResponse(json.dumps(objects))