Giter Site home page Giter Site logo

serpentai / requests-respectful Goto Github PK

View Code? Open in Web Editor NEW
417.0 417.0 27.0 22 KB

Minimalist Requests wrapper to work within rate limits of any amount of services simultaneously. Parallel processing friendly.

License: Other

Python 100.00%
python rate-limiting requests

requests-respectful's Introduction

Serpent.AI - Game Agent Framework (Python)



Update: Revival (May 2020)

Development work has resumed on the framework with the aim of bringing it into 2020: Python 3.8+, Less Dependencies, Ease of Use (Installer, GUI) and much more! Still open-source with a permissive license and looking into a Steam distribution for non-technical users. 🐍

Warning: End of life (November 2018)

Serpent.AI is a simple yet powerful, novel framework to assist developers in the creation of game agents. Turn ANY video game you own into a sandbox environment ripe for experimentation, all with familiar Python code. The framework's raison d'être is first and foremost to provide a valuable tool for Machine Learning & AI research. It also turns out to be ridiculously fun to use as a hobbyist (and dangerously addictive; a fair warning)!

The framework features a large assortment of supporting modules that provide solutions to commonly encountered scenarios when using video games as environments as well as CLI tools to accelerate development. It provides some useful conventions but is absolutely NOT opiniated about what you put in your agents: Want to use the latest, cutting-edge deep reinforcement learning algorithm? ALLOWED. Want to use computer vision techniques, image processing and trigonometry? ALLOWED. Want to randomly press the Left or Right buttons? sigh ALLOWED. To top it all off, Serpent.AI was designed to be entirely plugin-based (for both game support and game agents) so your experiments are actually portable and distributable to your peers and random strangers on the Internet.

Serpent.AI supports Linux, Windows & macOS.

The next version of the framework will officially stop supporting macOS. Apple's aversion to Nvidia in their products means no recent macOS machine can run CUDA, an essential piece of technology for Serpent.AI's real-time training. Other decisions like preventing 32-bit applications from running in Catalina and deprecating OpenGL do not help make a case to support the OS.

Experiment: Game agent learning to defeat Monstro (The Binding of Isaac: Afterbirth+)

Background

The project was born out of admiration for / frustration with OpenAI Universe. The idea is perfect, let's be honest, but some implementation details leave a lot to be desired. From these, the core tennets of the framework were established:

  1. Thou shall run natively. Thou shalt not use Docker containers or VNC servers.
  2. Thou shall allow a user to bring their own games. Thou shalt not wait for licensing deals and special game APIs.
  3. Thou shall encourage diverse and creative approaches. Thou shalt not only enable AI flavors of the month.

Want to know more about how Serpent.AI came to be? Read The Story Behind Serpent.AI on the blog!

Documentation

Guides, tutorials and videos are being produced and added to the GitHub Wiki. It currently is the official source of documentation.

Experiment: Game agent learning to match tiles (You Must Build a Boat)

Business Contact: [email protected]

requests-respectful's People

Contributors

nbrochu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

requests-respectful's Issues

Wait "thread safe"

Great work!
I've coded a thread safe alternative when using "wait=True" flag (python 3.3+).
Are you interested in a pull request?
Another question: I am using some session objects from requests lib, so I got exception in method "_validate_request_func". What's the purpose of this validation?

interested in supporting multiple realms per request?

I have a fork where I've added this because we needed the functionality... I didn't make it entirely backwards-compatible ('realm' argument changed to 'realms' in a lot of places) but it could be if you're interested in merging it. :)

I also fixed some tests and added Python 2 support (we're still stuck on it).

Unable to install via pip on Python 2.7.11 and Redis 2.10.5

Hello!

I'm unable to install the library. Here's my environment:

  • Mac OS X El Capitan 10.11.5
  • Python (Anaconda) 2.7.11
  • redis 2.10.5

Here's the error I get when running pip install requests-respectful:

$ pip install requests-respectful Collecting requests-respectful Using cached requests-respectful-0.1.0.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/kw/2n84gk1s2v5d4_s1p93vdjym0000gp/T/pip-build-LSndMf/requests-respectful/setup.py", line 10, in <module> import requests_respectful File "/private/var/folders/kw/2n84gk1s2v5d4_s1p93vdjym0000gp/T/pip-build-LSndMf/requests-respectful/requests_respectful/__init__.py", line 15, in <module> from .respectful_requester import RespectfulRequester File "/private/var/folders/kw/2n84gk1s2v5d4_s1p93vdjym0000gp/T/pip-build-LSndMf/requests-respectful/requests_respectful/respectful_requester.py", line 1, in <module> from .globals import default_config, config, redis File "/private/var/folders/kw/2n84gk1s2v5d4_s1p93vdjym0000gp/T/pip-build-LSndMf/requests-respectful/requests_respectful/globals.py", line 2, in <module> from redis import StrictRedis, ConnectionError ImportError: No module named redis

I appreciate your help with this and look forward to using the library.

May underestimate requests (unreliable use of SCAN)

In respectful_requester.py#L189, the pattern len(redis.scan()) is used.

According to the redis-py library documentation, scan() does no iteration itself, you are expected to use the returned cursor to fetch the remaining results manually. Line 189 seems to assume that passing a high enough count argument will ensure all results are returned, but according to the Redis documentation that is not the case.

The consequence is that _requests_in_timespan() might underestimate the number of requests in the timespan, making rate control unreliable.

A simple fix is to replace the scan() call with scan_iter(), which does ensure that the full result set is returned.

Abandoned project?

This project seems abandoned, however it is really useful for my current project. Is there any updated alternative that address the pending issues? Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.