import caniusepython3 as ciu


def main():
    import sys
    project = sys.argv[1]
    result = ciu.check(projects=[project])
    print(result)

if __name__ == '__main__':
    main()

from urllib.parse import urlparse

import caniusepython3 as ciu


def main():
    import sys
    project = sys.argv[1]

    # check if there is github page
    with ciu.pypi.pypi_client() as client:
        releases = client.package_releases(project)
        if not releases:
            print('NO releases found for {}'.format(project))
            sys.exit(1)

        got_github = False
        version = releases[0]
        package_data = client.package_data(project, version)

        classifiers = package_data['classifiers']
        if 'Programming Language :: Python :: 3' in classifiers:
            print('py3 OK')
            sys.exit(0)

        r = urlparse(package_data['home_page'])
        if r.netloc == 'github.com':
            got_github = True
        if got_github:
            print('github FOUND')
        else:
            print('github NOT FOUND')

    print('py3 NOT OK')
    sys.exit(1)

if __name__ == '__main__':
    main()

Update the script to directly use pypi client
Update the script to directly use pypi client

 * Faster to get to the data

+ from urllib.parse import urlparse
+ 
  import caniusepython3 as ciu
  
  
  def main():
      import sys
      project = sys.argv[1]
-     result = ciu.check(projects=[project])
-     print(result)
+ 
+     # check if there is github page
+     with ciu.pypi.pypi_client() as client:
+         releases = client.package_releases(project)
+         if not releases:
+             print('NO releases found for {}'.format(project))
+             sys.exit(1)
+ 
+         got_github = False
+         version = releases[0]
+         package_data = client.package_data(project, version)
+ 
+         classifiers = package_data['classifiers']
+         if 'Programming Language :: Python :: 3' in classifiers:
+             print('py3 OK')
+             sys.exit(0)
+ 
+         r = urlparse(package_data['home_page'])
+         if r.netloc == 'github.com':
+             got_github = True
+         if got_github:
+             print('github FOUND')
+         else:
+             print('github NOT FOUND')
+ 
+     print('py3 NOT OK')
+     sys.exit(1)
  
  if __name__ == '__main__':
      main()
  
Update the script to directly use pypi client
## Code Before:
import caniusepython3 as ciu


def main():
    import sys
    project = sys.argv[1]
    result = ciu.check(projects=[project])
    print(result)

if __name__ == '__main__':
    main()

## Instruction:
Update the script to directly use pypi client
## Code After:
from urllib.parse import urlparse

import caniusepython3 as ciu


def main():
    import sys
    project = sys.argv[1]

    # check if there is github page
    with ciu.pypi.pypi_client() as client:
        releases = client.package_releases(project)
        if not releases:
            print('NO releases found for {}'.format(project))
            sys.exit(1)

        got_github = False
        version = releases[0]
        package_data = client.package_data(project, version)

        classifiers = package_data['classifiers']
        if 'Programming Language :: Python :: 3' in classifiers:
            print('py3 OK')
            sys.exit(0)

        r = urlparse(package_data['home_page'])
        if r.netloc == 'github.com':
            got_github = True
        if got_github:
            print('github FOUND')
        else:
            print('github NOT FOUND')

    print('py3 NOT OK')
    sys.exit(1)

if __name__ == '__main__':
    main()
