+ 2

How do how do I use API’s?

How do I use APIs via python, say I want to use data from this game, how would I collect and use it? Can anyone provide help or links to help? Thanks.

29th Mar 2021, 9:24 AM
satire1123
satire1123 - avatar
2 Respostas
+ 2
If you need to collect information from a URL or talk with an HTTP API, you could use Python's requests package. More detail on requests is at: https://pypi.org/project/requests/ The requests package gives you the power to send any kind of HTTP request over HTTP or HTTPS. That includes GET, POST, PUT, DELETE... methods and any other specifics that you could need. If you have a specific API in mind, some API's make Python code available to help developers connect with it. For example, facebook has an SDK for Python documented at: https://facebook-sdk.readthedocs.io/en/latest/api.html You could also host an API using HTTP if you made a web server with Python. Flask makes that easy enough. Hosting your own server could be useful for a multiplayer game since it can be a central place to store a list of all gaming users, their scores, states of their games... It could be an intermediate place for relaying messages between players in the same game too. Most paid and professional games optimize peer to peer communication in fast-paced games on websites using WebRTC, though.
29th Mar 2021, 10:13 AM
Josh Greig
Josh Greig - avatar
+ 1
Wow! Really in depth response, thanks for the clarification. +1
29th Mar 2021, 10:26 AM
satire1123
satire1123 - avatar