{"id":13498157,"url":"https://github.com/theskumar/python-usernames","last_synced_at":"2025-04-03T02:09:32.986Z","repository":{"id":57457684,"uuid":"43309518","full_name":"theskumar/python-usernames","owner":"theskumar","description":"Ensures usernames are url friendly. No abusive/reserved words.","archived":false,"fork":false,"pushed_at":"2023-06-17T14:06:57.000Z","size":47,"stargazers_count":101,"open_issues_count":1,"forks_count":12,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-24T06:53:31.233Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theskumar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-28T15:31:47.000Z","updated_at":"2024-10-17T04:33:56.000Z","dependencies_parsed_at":"2024-06-19T00:20:37.820Z","dependency_job_id":"64926eea-788b-4bc3-a8e7-16bbc3a8b16f","html_url":"https://github.com/theskumar/python-usernames","commit_stats":{"total_commits":52,"total_committers":5,"mean_commits":10.4,"dds":0.5192307692307692,"last_synced_commit":"8784b15ac5a39984f4556a353658ba2c7b5cdb3b"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theskumar%2Fpython-usernames","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theskumar%2Fpython-usernames/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theskumar%2Fpython-usernames/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theskumar%2Fpython-usernames/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theskumar","download_url":"https://codeload.github.com/theskumar/python-usernames/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246922247,"owners_count":20855345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T20:00:52.510Z","updated_at":"2025-04-03T02:09:32.968Z","avatar_url":"https://github.com/theskumar.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# python-usernames\n\n[![Build\nStatus](https://travis-ci.org/theskumar/python-usernames.svg?branch=v0.1.0)](https://travis-ci.org/theskumar/python-usernames)\n[![Coverage\nStatus](https://coveralls.io/repos/theskumar/python-usernames/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/theskumar/python-usernames?branch=master)\n[![PyPI\nversion](https://badge.fury.io/py/python-usernames.svg)](http://badge.fury.io/py/python-usernames)\n\nPython library to validate usernames suitable for use in public facing\napplications where use can choose login names and sub-domains.\n\n## Features\n\n-   Provides a default regex validator\n-   Validates against list of [banned\n    words](https://github.com/theskumar/python-usernames/blob/master/usernames/reserved_words.py)\n    that should not be used as username.\n-   Python 3.8+\n\n## Installation\n\n    pip install python-usernames\n\n## Usages\n\n```python\nfrom python_usernames import is_safe_username\n\n\u003e\u003e\u003e is_safe_username(\"jerk\")\nFalse  # contains one of the banned words\n\n\u003e\u003e\u003e is_safe_username(\"handsome!\")\nFalse  # contains non-url friendly `!`\n```\n\n**is\\_safe\\_username** takes the following optional arguments:\n\n-   `whitelist`: a case insensitive list of words that should be\n    considered as always safe. Default: `[]`\n-   `blacklist`: a case insensitive list of words that should be\n    considered as unsafe. Default: `[]`\n-   `max_length`: specify the maximun character a username can have.\n    Default: `None`\n\n- `regex`: regular expression string that must pass before the banned\n:   words is checked.\n\nThe default regular expression is as follows:\n\n    ^                       # beginning of string\n    (?!_$)                  # no only _\n    (?![-.])                # no - or . at the beginning\n    (?!.*[_.-]{2})          # no __ or _. or ._ or .. or -- inside\n    [a-zA-Z0-9_.-]+         # allowed characters, atleast one must be present\n    (?\u003c![.-])               # no - or . at the end\n    $                       # end of string\n\n## Further Reading\n\n-   [Let’s talk about\n    usernames](https://www.b-list.org/weblog/2018/feb/11/usernames/)\n\n## Gotchas\n\nWords like `bigcock12` will validated just fine, only equality against\nthe [banned word\nlists](https://github.com/theskumar/python-usernames/blob/master/usernames/reserved_words.py)\nis checked. We don't try to be smart to avoid [Scunthorpe\nproblem](https://en.wikipedia.org/wiki/Scunthorpe_problem). If you can\ncome up with a algorithm/solution, please create an issue/pr :).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheskumar%2Fpython-usernames","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheskumar%2Fpython-usernames","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheskumar%2Fpython-usernames/lists"}