Giter Site home page Giter Site logo

robohash's Introduction

RoboHash

The source code for RoboHash.org.

It basically copy/pastes various robot pictures together, using bits from the SHA hash. It's not perfect, and not entirely secure, but it gives a good gut-check to "Hey, this SHA is wrong."

Install

Just the library:

$ pip install robohash

Or if you also want the web frontend:

$ pip install robohash[web]

Usage

from robohash import Robohash

hash = "whatever-hash-you-want"
rh = Robohash(hash)
rh.assemble(roboset='any')
with open("path/to/new/file.png", "wb") as f:
    rh.img.save(f, format="png")

Robosets

RoboHash comes with five image sets, named "set1", "set2", "set3", "set4" and "set5". Specify which set you want in the assemble() method. Alternatively, specify the string "any", and RoboHash will pick an image set for you, based on the provided hash.

License

The Python Code is available under the MIT/Expat license. See the LICENSE.txt file for the full text of this license. Copyright (c) 2011.

Feel free to embed the Robohash images, host your own instance of Robohash, or integrate them into your own project. If you do, please just mention where they came from :) Example wording might be "Robots lovingly delivered by Robohash.org" or similar.

The "set1" artwork (and robohash backgrounds) were created by Zikri Kader. They are available under CC-BY-3.0 or CC-BY-4.0 license.

The "set2" artwork was created by Hrvoje Novakovic. They are available under CC-BY-3.0 license.

The "set3" artwork was created by Julian Peter Arias. They are available under CC-BY-3.0 license.

The Cats/"set4" were created by David Revoy, used under CC-BY-4.0 https://www.peppercarrot.com/en/article391/cat-avatar-generator

The avatars used in "set5" were created by Pablo Stanley, for https://avataaars.com/ They are "Free for personal and commercial use. 😇"

Disclaimer

OK, I'll admit I'm a crappy programmer. Compounding this, I wrote this code initially to be internal-only. It's ugly, and could be a LOT nicer.

Sorry about that.

robohash's People

Contributors

e1ven avatar flimm avatar jedevc avatar mrts avatar npellegrin avatar ofalk avatar samfoo avatar samsaffron avatar simonfranz avatar singingwolfboy avatar uncommon 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robohash's Issues

Bump the version

Could you release a new version to PyPI, because v1.0.0 is affected by the sorting issue?

Usage Instructions

I've managed to import the Robohash module just fine by creating an arbitrary file.

Does the script run on the fly or does anything need to be compiled or processed first?

Any assistance much appreciated - great library, I'd like to get better at understanding it's usage and hopefully provide more useful feedback.

Thanks,
Mark

Incrementing Bgset stops at 2?

I tried to go past bgset2 and i wasn't able to get any images behind my robots

Link not working: https://robohash.org/3f6e64bb.png?bgset=bg3

BTW absolutely love the library, using it my app :)

One particular IP address crashes, but only on set5

This is weird:

import robohash
rh = robohash.Robohash("65.255.59.74")
rh.assemble(roboset='set5')

Traceback (most recent call last):
File "", line 1, in
File "robohash/robohash.py", line 183, in assemble
roboimg.paste(img,(0,0),img)
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1457, in paste
self.im.paste(im, box, mask.im)
ValueError: bad transparency mask

Change the IP address by one digit, change the set, and it works fine.

pip freeze | grep -i robo
robohash==1.0

Am I doing something wrong? Love this program, and it's so helpful in telling when my IP address has changed...

"UnicodeDecodeError: 'charmap' codec can't decode byte 0x9f in position 1732" during pip install in Windows

with open('README.rst') as file:
    long_description = file.read()

will fail in Windows in Git Bash with the following error:

$ pip install -r requirements.txt                                                                               Collecting git+https://github.com/e1ven/Robohash.git (from -r backend/requirements.txt (line 24))
  Cloning https://github.com/e1ven/Robohash.git to c:\users\foo\appdata\local\temp\pip-req-build-csx0_u6g
  Running command git clone -q https://github.com/e1ven/Robohash.git 'C:\Users\foo\AppData\Local\Temp\pip-req-build-csx0_u6g'
    ERROR: Command errored out with exit status 1:
     command: 'c:\devel\other\heedview\venv\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\foo\\AppData\\Local\\Temp\\pip-req-build-csx0_u6g\\setup.py'"'"'; __file__='"'"'C:\\Users\\foo\\AppData\\Local\\Temp\\pip-req-build-csx0_u6g\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:\Users\foo\AppData\Local\Temp\pip-req-build-csx0_u6g\
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\foo\AppData\Local\Temp\pip-req-build-csx0_u6g\setup.py", line 7, in <module>
        long_description = file.read()
      File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\encodings\cp1257.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x9f in position 1732: character maps to <undefined>
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Windows Git Bash uses cp1257 encoding by default, README contains Unicode emoji that doesn't have a mapping in cp1257, hence the error.

Fix is simple, use

with open('README.rst', encoding='utf-8') as file:

Site's down :(

Can't access robohash.com, anything we can do to help?

Thanks!

set5 isn't being displayed and slower than the other sets

Through the caching the new set5 isnt displayed on the main page.

Besides that, there seems to be an performance-issue.
Generating a hash with set 4 are at average at 1 second. Generating a image for a hash with set5 need up to 10 seconds. Is there a need to resize the images of set5 to decrease response-time?

best regards

Images and GPL compatibility

I realize this is not your main concern for this package, but is there a chance to get in touch with the artists and ask them to relicense (or dual-license) the images as CC-BY-4.0 to allow for compatibility with GPL-licensed implementations? I wanted to integrate @nimiq's Robohash SVG into my WordPress plugin Avatar Privacy, but it looks like their SVG parts are derived from Zikri Kader's set1. (They might have relicensed them from Zikri, but going with proven provenance PNG icons seems safer.)

500 errors continue

Similarly to #51, more 500s:

$ curl https://robohash.org/asdf\?size\=32x32
<html><title>500: Internal Server Error</title><body>500: Internal Server Error</body></html>

10% chance of slow response

I've got a page that downloads 10-ish robohash robots. I'm finding that often 1 of the 10 robots will take about a minute to download while the rest are rather quick. Is this normal?

On Apache Server

Hello,

Anyone have tried to run this on apache based system? With mod_wsgi?

URL's are not responding

The API responds with a URL, but the URL is non-responding. I can see robohash.org has the same issue. Pretty sure it worked yesterday.

Failed to load resource: net::ERR_EMPTY_RESPONSE

Here be dragons!

Not an issue but I made it so.

I made this...

http://www.robotrak.tk

Images does not match for the same hash but different sizes

Hello!

For some reason robohash generates different image for a hash when specifying different sizes.

I've tried different sizes and found, that images does not match for 64x and 63x sizes.

Yellow robot:

Purple robot:

Thank you.

2015-04-02 10 29 18

Wrong image set

Using https://robohash.org/kitty?set=set4 I am getting a kitty picture like it should:

But if I provide https://robohash.org/kittytit?set=set4 I am getting a robot:

And if I try something close to it like https://robohash.org/kittyt?set=set4 then I'm getting back a kitty again:

Not sure what went wrong there... 😋

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.