All Projects → smiley → Steamapi

smiley / Steamapi

Licence: mit
An unofficial object-oriented Python library for accessing the Steam Web API.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Steamapi

Vulcain
Fast and idiomatic client-driven REST APIs.
Stars: ✭ 3,190 (+693.53%)
Mutual labels:  rest-api, rest
Flask Appbuilder
Simple and rapid application development framework, built on top of Flask. includes detailed security, auto CRUD generation for your models, google charts and much more. Demo (login with guest/welcome) - http://flaskappbuilder.pythonanywhere.com/
Stars: ✭ 3,603 (+796.27%)
Mutual labels:  rest-api, rest
Guns
Guns基于SpringBoot 2,致力于做更简洁的后台管理系统,完美整合springmvc + shiro + mybatis-plus + beetl!Guns项目代码简洁,注释丰富,上手容易,同时Guns包含许多基础模块(用户管理,角色管理,部门管理,字典管理等10个模块),可以直接作为一个后台管理系统的脚手架!
Stars: ✭ 3,327 (+727.61%)
Mutual labels:  rest-api, rest
Vscode Restclient
REST Client Extension for Visual Studio Code
Stars: ✭ 3,289 (+718.16%)
Mutual labels:  rest-api, rest
Gramework
Fast and Reliable Golang Web Framework
Stars: ✭ 354 (-11.94%)
Mutual labels:  rest-api, rest
Restyped
End-to-end typing for REST APIs with TypeScript
Stars: ✭ 287 (-28.61%)
Mutual labels:  rest-api, rest
Imbo
Imbo is an image "server" that can be used to add/get/delete images using a RESTful interface.
Stars: ✭ 312 (-22.39%)
Mutual labels:  rest-api, rest
Prest
PostgreSQL ➕ REST, low-code, simplify and accelerate development, ⚡ instant, realtime, high-performance on any Postgres application, existing or new
Stars: ✭ 3,023 (+651.99%)
Mutual labels:  rest-api, rest
Ws
⚠️ Deprecated - (in favour of Networking) ☁️ Elegantly connect to a JSON api. (Alamofire + Promises + JSON Parsing)
Stars: ✭ 352 (-12.44%)
Mutual labels:  rest-api, rest
Admin
A beautiful and fully-featured administration interface builder for hypermedia APIs
Stars: ✭ 335 (-16.67%)
Mutual labels:  rest-api, rest
Spring Petclinic Rest
REST version of the Spring Petclinic sample application
Stars: ✭ 257 (-36.07%)
Mutual labels:  rest-api, rest
Node Rest Client
REST API client from node.js
Stars: ✭ 365 (-9.2%)
Mutual labels:  rest-api, rest
Httpie
As easy as /aitch-tee-tee-pie/ 🥧 Modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. https://twitter.com/httpie
Stars: ✭ 53,052 (+13097.01%)
Mutual labels:  rest-api, rest
Jaguar
Jaguar, a server framework built for speed, simplicity and extensible. ORM, Session, Authentication & Authorization, OAuth
Stars: ✭ 286 (-28.86%)
Mutual labels:  rest-api, rest
Http Fake Backend
Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 253 (-37.06%)
Mutual labels:  rest-api, rest
Json Server Heroku
Deploy json-server to Heroku & Azure 🆙 🆓
Stars: ✭ 310 (-22.89%)
Mutual labels:  rest-api, rest
Wp Rest Api Cache
Enable caching for WordPress REST API and increase speed of your application
Stars: ✭ 239 (-40.55%)
Mutual labels:  rest-api, rest
Fosrestbundle
This Bundle provides various tools to rapidly develop RESTful API's with Symfony
Stars: ✭ 2,683 (+567.41%)
Mutual labels:  rest-api, rest
Kanary
A minimalist web framework for building REST APIs in Kotlin/Java.
Stars: ✭ 319 (-20.65%)
Mutual labels:  rest-api, rest
Rest Api Response Format
REST API response format using HTTP status codes
Stars: ✭ 356 (-11.44%)
Mutual labels:  rest-api, rest

SteamAPI Build Status

An object-oriented Python 2.7+/3.5+ library for accessing the Steam Web API.

What's this?

It's a Python library for accessing Steam's Web API, which separates the JSON, HTTP requests, authentication and other web junk from your Python code. Your code will still ask the Steam Web API for bits and bobs of user profiles, games, etc., but invisibly, lazily, and in a cached manner.

It's super-easy to use, straightforward and designed for continuous use. Finally, an easy way to interface with Steam!

How?

With some abstraction, Pythonic classes and magic tricks. Essentially, I use requests for the actual communication, a few converter classes for parsing the output and making it a proper object, and some well-timed caching to make sure lazy-initialization doesn't get you down.

How do I use this?

Clone the repository & run python setup.py develop. (Or download it & run python setup.py install, which copies the code to your local Python packages folder)

Then, you can use it like this:

>>> import steamapi
>>> steamapi.core.APIConnection(api_key="ABCDEFGHIJKLMNOPQRSTUVWXYZ", validate_key=True)  # <-- Insert API key here
>>> steamapi.user.SteamUser(userurl="smileybarry")  # For http://steamcommunity.com/id/smileybarry
Or:
>>> steamapi.user.SteamUser(76561197996416028)  # Using the 64-bit Steam user ID
<SteamUser "Smiley" (76561197996416028)>
>>> me = _
>>> me.level
22
>>> me.friends
[<SteamUser "Bill" (9876543210987654321)>, <SteamUser "Ted" (1234876598762345)>, ...]

Or maybe even like this:

...
>>> me.recently_played
[<SteamApp "Dishonored" (205100)>, <SteamApp "Saints Row: The Third" (55230)>, ...]
>>> me.games
[<SteamApp "Counter-Strike: Source" (240)>, <SteamApp "Team Fortress Classic" (20)>, <SteamApp "Half-Life: Opposing Force" (50)>, ...]

More examples

Flask-based web service

How about a Flask web service that tells a user how many games & friends he has?

from flask import Flask, render_template
from steamapi import core, user

app = Flask("Steamer")
core.APIConnection(api_key="YOURKEYHERE")

@app.route('/user/<name>')
def hello(name=None):
  try:
    try:
      steam_user = user.SteamUser(userid=int(name))
    except ValueError: # Not an ID, but a vanity URL.
      steam_user = user.SteamUser(userurl=name)
    name = steam_user.name
    content = "Your real name is {0}. You have {1} friends and {2} games.".format(steam_user.real_name,
                                                                                  len(steam_user.friends),
                                                                                  len(steam_user.games))
    img = steam_user.avatar
    return render_template('hello.html', name=name, content=content, img=img)
  except Exception as ex:
    # We might not have permission to the user's friends list or games, so just carry on with a blank message.
    return render_template('hello.html', name=name)
  
if __name__ == '__main__':
  app.run()

(hello.html can be found here)

You can try it out for yourself by cloning/downloading a ZIP and deploying it to Google App Engine for free.


The library was made for both easy use and easy prototyping. It supports auto-completion in IPython and other standards-abiding interpreters, even with dynamic objects (APIResponse). I mean, what good is an API if you constantly have to have the documentation, a browser and a web debugger open to figure it out?

Note that you need an API key for most commands, but API keys can be obtained immediately, for free, from the Steam Web API developer page.

The API registration page requires a domain, but it's only a formality. It's not enforced by the API server.

FAQ

Don't see your question here? More questions were asked and answered in the "Issues" section.

Does this work?

Yep! You can try the examples above, or you can just jump in and browse the API using an interpreter. I recommend IPython; it has some awesome auto-completion, search & code inspection.

How can I get * using the API? I can't find it here.

You can open a Python interpreter and play around with the library. It's suited for experimentation and prototyping, to help prevent these exact cases. A full documentation will be available soon.

If you still can't find it, I might've not implemented it yet. This is still a work in progress. Don't worry though, I plan to have the entire public API mapped & available soon!

I have a feature/change that I think should go in. How can I participate?

You can do one of two things:

  1. Fork the repository and make your changes. When you're done, send me a pull request and I'll look at it.
  2. Open a ticket and tell me about it. My aim is to create the best API library in terms of comfort, flexibility and capabilities, and I can't do that alone. I'd love to hear about your ideas.

Is this official?

No, and it's also not endorsed in any way by Valve Corporation. (obligatory legal notice) I couldn't find a fitting name at this point for it, so I just skipped it for now.

Can I use this library in my busy web app?

No, but feel free to experiment with it. It's roughly stable right now, with many of the quirks fixed and most classes having a steady API. Small refactorings are rare, and I do plan to overhaul the object system to allow async/batching behaviour, but that's still a way off.

Is this still actively-developed? The last commit is quite a while ago!

Sadly, not anymore. This isn't abandoned or archived but, as you can tell, I haven't touched it in years. I've moved on and the projects I had in mind for this library (and the reason I wrote it) are dead at this point. If you'd like to add or change things, you can fork the repository and open a pull request, despite the above I can still review and accept changes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].