Get github username through primary email

Viewed 15295

I'm using the PyGithub library to invite new member to the organization. The issue I faced is the next: In the scenario, when I know only users primary email, how can I retrieve his username to proceed invite accordingly? I know it is possible through UI, but can't find the corresponding call through API. Please, assist!

3 Answers

I have public email address on github, but not able to get my username passing the email address

-bash-4.2$ curl -i -s  https://api.github.com/search/users?q=kamu.raju@gmail.com
    HTTP/1.1 200 OK
    Server: GitHub.com
    Date: Sun, 09 May 2021 15:00:13 GMT
    Content-Type: application/json; charset=utf-8
    Cache-Control: no-cache
    Vary: Accept, Accept-Encoding, Accept, X-Requested-With
    X-GitHub-Media-Type: github.v3; format=json
    Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X- 
    RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X- 
    RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub- 
    Media-Type, Deprecation, Sunset
    Access-Control-Allow-Origin: *
    Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    X-Frame-Options: deny
    X-Content-Type-Options: nosniff
    X-XSS-Protection: 0
    Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    Content-Security-Policy: default-src 'none'
    X-RateLimit-Limit: 10
    X-RateLimit-Remaining: 8
    X-RateLimit-Reset: 1620572473
    X-RateLimit-Resource: search
    X-RateLimit-Used: 2
    Accept-Ranges: bytes
    Content-Length: 73
    X-GitHub-Request-Id: 8CAA:5135:2353C0C:3D598CC:6097F908

    {
    "total_count": 0,
    "incomplete_results": false,
    "items": [

     ]
     }

enter image description here

Related