Introducing a public autocomplete API for steem usernames

in #utopian-io7 years ago (edited)

steem.rocks landing page includes a simple input which you can enter your username to that field and continue using the site.

Almost all 3rd party steem related websites ask for usernames at some point. I wanted to add an auto-complete feature here, so users can type a few characters and select their username.


Auto complete feature on Steemit wallet

Instead of doing that as a steem.rocks centered feature, I developed a public API which every 3rd party developer can use and benefit.

How it works?

  1. It indexes all usernames in the Steem chain by using the lookup_accounts call.

  2. Then it stores all usernames in the redis with sorted sets to get auto-complete functionality. (Thanks to beautiful walrus library)

Using it as a client

Just pass ?username to that address:

http://autocomplete.steem.rocks/?username=utopia


Autocomplete options for utopia

Running on your own

You can run your own autocomplete API instance.

Installation

$ git https://github.com/emre/steem-username-autocomplete-api.git
$ cd steem-username-autocomplete-api
$ virtualenv -p python3.6 autocomplete-api-env
$ source autocomplete-api-env/bin/activate
$ pip install -r requirements.txt
Indexing the database
$ FLASK_APP=autocomplete_api/app.py flask initdb

Note: Indexing all steem usernames takes 10 minutes on my development setup.

Serving the api
$ FLASK_APP=autocomplete_api/app.py flask run

Feel free to test, debug, break it. Just let me know after that. :)

Github Repository: @emre/steem-username-autocomplete-api



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @emrebeyler I am @utopian-io. I have just upvoted you!

Achievements

  • WOW WOW WOW People loved what you did here. GREAT JOB!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

that's the spirit, refreshing page to give it an up vote. :)

Hah, what do you know, I was looking for a way to do autocompletes in my bot. You're a thousand steps ahead of me, as always, emre!

not really a big deal, I just connected some parts. :)

Nice one! Noticed the new logo and landing page on steem.rocks today, starting to use it more and more vs the alternatives.

thanks! @favcau did the new homepage. More improvements are coming soon.

Bir utopian-io post atmayı öğrenemedim :)

This is absolutely wonderful. Good Job

What have we here, 2 year !BEER


Hey @emrebeyler, here is a little bit of BEER from @isnochys for you. Enjoy it!

Learn how to earn FREE BEER each day by staking.

Coin Marketplace

STEEM 0.16
TRX 0.13
JST 0.027
BTC 57642.15
ETH 2578.06
USDT 1.00
SBD 2.49