Introducing a public autocomplete API for steem usernames
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.
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?
It indexes all usernames in the Steem chain by using the lookup_accounts call.
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
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
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
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
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
You rock! \O/
\m/
that's the spirit, refreshing page to give it an up vote. :)
thanks.
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
thanks.
What have we here, 2 year !BEER
View or trade
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.