我如何将 SteamAPI 与 Django 一起使用?

How can i use SteamAPI with Django?

这怎么可能?我正在尝试在我的网站中添加 Steam 身份验证按钮并获取一般信息:用户名、Steam ID。

例如这样的东西:

views.py:

# Example
from django.shortcuts import render
from django.http return HttpResponse

def index(response):
    ...
    return render('link.html', response) # link html contains <a> tag which should lead to steam authentication.
    ...

def afterauth(request):
    if auth = SteamAuth.wasSucessful:
        return HttpResponse("Username: " + SteamAuth.Username() + "SteamID: " + SteamAuth.ID())

我已经获得了 API 密钥,但是我找不到任何关于如何在 Django 中使用它的文档。

有什么办法可以实现吗?有没有我可以在 Django 中使用 Steam API 的教程或文档?

您可以使用原生支持 django 和 steam 的 python-social-auth 包 API:

Multiple frameworks are supported:

  • Django
  • Flask
  • Pyramid
  • Webpy
  • Tornado

Auth providers

  • ...
  • Soundcloud OAuth2
  • Whosebug OAuth2
  • Steam OpenId
  • Stocktwits OAuth2
  • Strava OAuth2
  • Stripe OAuth2
  • ...