create account

Introducing a public autocomplete API for steem usernames by emrebeyler

View this thread on: hive.blogpeakd.comecency.com
· @emrebeyler · (edited)
$116.27
Introducing a public autocomplete API for steem usernames
[steem.rocks](http://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.

<img src="https://i.hizliresim.com/QpkMqj.png">
<center>*Auto complete feature on Steemit wallet*</center>

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](https://github.com/steemit/steem/blob/06e67bd4aea73391123eca99e1a22a8612b0c47e/libraries/app/include/steemit/app/database_api.hpp#L250) call.

2. Then it stores all usernames in the redis with sorted sets to get auto-complete functionality. (Thanks to beautiful  [walrus library](http://walrus.readthedocs.io/en/latest/autocomplete.html))

#### Using it as a client

Just pass ?username to that address:

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

<img src="https://i.hizliresim.com/8NG1VW.png">
<center>*Autocomplete options for utopia*</center>

#### 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](https://github.com/emre/steem-username-autocomplete-api)


<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@emrebeyler/introducing-a-public-autocomplete-api-for-steem-usernames">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 20 others
properties (23)
authoremrebeyler
permlinkintroducing-a-public-autocomplete-api-for-steem-usernames
categoryutopian-io
json_metadata"{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":115939088,"name":"steem-username-autocomplete-api","full_name":"emre/steem-username-autocomplete-api","owner":{"login":"emre","id":72460,"avatar_url":"https://avatars0.githubusercontent.com/u/72460?v=4","gravatar_id":"","url":"https://api.github.com/users/emre","html_url":"https://github.com/emre","followers_url":"https://api.github.com/users/emre/followers","following_url":"https://api.github.com/users/emre/following{/other_user}","gists_url":"https://api.github.com/users/emre/gists{/gist_id}","starred_url":"https://api.github.com/users/emre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emre/subscriptions","organizations_url":"https://api.github.com/users/emre/orgs","repos_url":"https://api.github.com/users/emre/repos","events_url":"https://api.github.com/users/emre/events{/privacy}","received_events_url":"https://api.github.com/users/emre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/emre/steem-username-autocomplete-api","description":"A simple HTTP api for steem usernames for auto-complete frontends","fork":false,"url":"https://api.github.com/repos/emre/steem-username-autocomplete-api","forks_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/forks","keys_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/teams","hooks_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/hooks","issue_events_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/issues/events{/number}","events_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/events","assignees_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/assignees{/user}","branches_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/branches{/branch}","tags_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/tags","blobs_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/statuses/{sha}","languages_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/languages","stargazers_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/stargazers","contributors_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/contributors","subscribers_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/subscribers","subscription_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/subscription","commits_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/contents/{+path}","compare_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/merges","archive_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/downloads","issues_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/issues{/number}","pulls_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/pulls{/number}","milestones_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/milestones{/number}","notifications_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/labels{/name}","releases_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/releases{/id}","deployments_url":"https://api.github.com/repos/emre/steem-username-autocomplete-api/deployments","created_at":"2018-01-01T18:47:18Z","updated_at":"2018-01-01T19:35:34Z","pushed_at":"2018-01-01T20:08:49Z","git_url":"git://github.com/emre/steem-username-autocomplete-api.git","ssh_url":"git@github.com:emre/steem-username-autocomplete-api.git","clone_url":"https://github.com/emre/steem-username-autocomplete-api.git","svn_url":"https://github.com/emre/steem-username-autocomplete-api","homepage":null,"size":4,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","score":10.310219},"pullRequests":[],"platform":"github","type":"development","tags":["utopian-io","steemrocks","python","sndbox"],"users":["emre","emrebeyler"],"links":["http://steem.rocks","https://github.com/steemit/steem/blob/06e67bd4aea73391123eca99e1a22a8612b0c47e/libraries/app/include/steemit/app/database_api.hpp#L250","http://walrus.readthedocs.io/en/latest/autocomplete.html","https://github.com/emre/steem-username-autocomplete-api"],"moderator":{"account":"codingdefined","reviewed":true,"pending":false,"flagged":false}}"
created2018-01-01 20:26:12
last_update2018-01-06 22:23:33
depth0
children15
last_payout2018-01-08 20:26:12
cashout_time1969-12-31 23:59:59
total_payout_value82.838 HBD
curator_payout_value33.435 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,212
author_reputation448,535,049,068,622
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries
0.
accountutopian.pay
weight2,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,430,324
net_rshares11,803,830,630,286
author_curate_reward""
vote details (84)
@akintunde · (edited)
This is absolutely wonderful. Good Job
properties (22)
authorakintunde
permlinkre-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180101t225023486z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-01-01 22:50:27
last_update2018-01-03 04:21:24
depth1
children1
last_payout2018-01-08 22:50:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length38
author_reputation16,541,536,778,040
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,447,285
net_rshares0
@emrebeyler ·
thanks.
properties (22)
authoremrebeyler
permlinkre-akintunde-re-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180103t060432427z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-01-03 06:04:33
last_update2018-01-03 06:04:33
depth2
children0
last_payout2018-01-10 06:04:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7
author_reputation448,535,049,068,622
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,708,482
net_rshares0
@beerlover ·
<div class='pull-right'>https://cdn.steemitimages.com/DQmaHThyECGhEx8tSfHZbiMFRNYjJ35K92cDgiJjkzBUaJo/One%20sip%20of%20BEER%20for%20you.gif<p><sup><a href='https://steem-engine.com/?p=market&t=BEER'>View or trade </a> <code>BEER</code>.</sup></p></div><center><br> <p> Hey @emrebeyler, here is a little bit of <code>BEER</code> from @isnochys for you. Enjoy it!</p> <p>Learn how to <a href='https://steemit.com/beer/@beerlover/what-is-proof-of-stake-with-beer'>earn FREE BEER each day </a> by staking.</p> </center><div></div>
properties (22)
authorbeerlover
permlinkre-introducing-a-public-autocomplete-api-for-steem-usernames-20200101t050720z
categoryutopian-io
json_metadata"{"app": "beem/0.21.1"}"
created2020-01-01 05:07:24
last_update2020-01-01 05:07:24
depth1
children0
last_payout2020-01-08 05:07:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length526
author_reputation25,811,331,779,356
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,914,285
net_rshares0
@codingdefined ·
$0.05
Thank you for the contribution. It has been approved.

You can contact us on [Discord](https://discord.gg/UCvqCsx).
**[[utopian-moderator]](https://utopian.io/moderators)**
👍  
properties (23)
authorcodingdefined
permlinkre-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180102t051757291z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-01-02 05:17:57
last_update2018-01-02 05:17:57
depth1
children0
last_payout2018-01-09 05:17:57
cashout_time1969-12-31 23:59:59
total_payout_value0.036 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length172
author_reputation532,929,792,362,974
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,491,846
net_rshares4,210,700,986
author_curate_reward""
vote details (1)
@cryptonik ·
You rock! \O/
properties (22)
authorcryptonik
permlinkre-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180101t204701357z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-01-01 20:47:00
last_update2018-01-01 20:47:00
depth1
children1
last_payout2018-01-08 20:47:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length13
author_reputation2,299,620,450,256
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,432,867
net_rshares0
@emrebeyler ·
\m/
properties (22)
authoremrebeyler
permlinkre-cryptonik-re-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180101t205745173z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-01-01 20:57:45
last_update2018-01-01 20:57:45
depth2
children0
last_payout2018-01-08 20:57:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3
author_reputation448,535,049,068,622
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,434,037
net_rshares0
@isnochys ·
What have we here, 2 year !BEER
properties (22)
authorisnochys
permlinkre-introducing-a-public-autocomplete-api-for-steem-usernames-20200101t050703z
categoryutopian-io
json_metadata"{"app": "beem/0.20.23"}"
created2020-01-01 05:07:06
last_update2020-01-01 05:07:06
depth1
children0
last_payout2020-01-08 05:07:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length31
author_reputation47,886,018,797,724
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,914,277
net_rshares0
@jestemkioskiem · (edited)
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!
properties (22)
authorjestemkioskiem
permlinkre-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180101t210547102z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-01-01 21:05:54
last_update2018-01-01 21:16:36
depth1
children1
last_payout2018-01-08 21:05:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length131
author_reputation41,292,066,961,817
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,434,944
net_rshares0
@emrebeyler ·
not really a big deal, I just connected some parts. :)
properties (22)
authoremrebeyler
permlinkre-jestemkioskiem-re-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180102t055753662z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-01-02 05:57:54
last_update2018-01-02 05:57:54
depth2
children0
last_payout2018-01-09 05:57:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length54
author_reputation448,535,049,068,622
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,496,658
net_rshares0
@oliverbix ·
Bir utopian-io post atmayı öğrenemedim :)
properties (22)
authoroliverbix
permlinkre-emrebeyler-201812t13438894z
categoryutopian-io
json_metadata{"tags":["utopian-io","steemrocks","python","sndbox"],"app":"esteem/1.5.0","format":"markdown+html","community":"esteem"}
created2018-01-01 22:35:45
last_update2018-01-01 22:35:45
depth1
children0
last_payout2018-01-08 22:35:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length41
author_reputation1,339,239,805,340
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries
0.
accountesteemapp
weight500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,445,596
net_rshares0
@oups ·
 that's the spirit, refreshing page to give it an up vote. :)
properties (22)
authoroups
permlinkre-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180101t204901190z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-01-01 20:49:03
last_update2018-01-01 20:49:03
depth1
children1
last_payout2018-01-08 20:49:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length61
author_reputation20,674,011,682,802
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,433,090
net_rshares0
@emrebeyler ·
thanks.
properties (22)
authoremrebeyler
permlinkre-oups-re-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180102t055942532z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-01-02 05:59:42
last_update2018-01-02 05:59:42
depth2
children0
last_payout2018-01-09 05:59:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7
author_reputation448,535,049,068,622
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,496,890
net_rshares0
@sambillingham ·
Nice one! Noticed the new logo and landing page on steem.rocks today, starting to use it more and more vs the alternatives.
properties (22)
authorsambillingham
permlinkre-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180101t215108148z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-01-01 21:51:09
last_update2018-01-01 21:51:09
depth1
children1
last_payout2018-01-08 21:51:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length123
author_reputation34,876,406,478,004
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,440,422
net_rshares0
@emrebeyler ·
thanks! @favcau did the new homepage. More improvements are coming soon.
properties (22)
authoremrebeyler
permlinkre-sambillingham-re-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180102t055731144z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["favcau"],"app":"steemit/0.1"}
created2018-01-02 05:57:33
last_update2018-01-02 05:57:33
depth2
children0
last_payout2018-01-09 05:57:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length72
author_reputation448,535,049,068,622
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,496,611
net_rshares0
@utopian-io ·
### 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. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER!
- <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a>
- <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a>
- Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a>

[![mooncryption-utopian-witness-gif](https://steemitimages.com/DQmYPUuQRptAqNBCQRwQjKWAqWU3zJkL3RXVUtEKVury8up/mooncryption-s-utopian-io-witness-gif.gif)](https://steemit.com/~witnesses)

**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**
👍  
properties (23)
authorutopian-io
permlinkre-emrebeyler-introducing-a-public-autocomplete-api-for-steem-usernames-20180103t040809445z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-01-03 04:08:09
last_update2018-01-03 04:08:09
depth1
children0
last_payout2018-01-10 04:08:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,065
author_reputation152,955,367,999,756
root_title"Introducing a public autocomplete API for steem usernames"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,691,196
net_rshares179,666,632
author_curate_reward""
vote details (1)