w3resource

Python: Find the Requests module version, licence, copyright information, author, author email, document url, title and description

Python Requests: Exercise-1 with Solution

Write a Python code to find the Requests module – version, licence, copyright information, author, author email, document url, title and description.

Sample Solution:

Python Code:

import requests
print("Python Requests module - version:",requests.__version__)
print("Licence:",requests. __license__)
print("Copyright:",requests.__copyright__)
print("Author:",requests.__author__)
print("Author email:",requests.__author_email__)
print("Document url, title, description:")
print(requests.__url__)
print(requests.__title__)
print(requests.__description__)

Sample Output:

Python Requests module - version: 2.22.0
Licence: Apache 2.0
Copyright: Copyright 2019 Kenneth Reitz
Author: Kenneth Reitz
Author email: [email protected]
Document url, title, description:
http://python-requests.org
requests
Python HTTP for Humans.

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Python Requests Exercise Home.
Next: Write a Python code to check the status code issued by a server in response to a client's request made to the server. Print all of the methods and attributes available to objects on successful request.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz


Python: Tips of the Day

Creates a dictionary with the same keys as the provided dictionary and values generated by running the provided function for each value:

Example:

def tips_map_values(obj, fn):
  ret = {}
  for key in obj.keys():
    ret[key] = fn(obj[key])
  return ret
users = {
  'Owen': { 'user': 'Owen', 'age': 29 },
  'Eddie': { 'user': 'Eddie', 'age': 15 }
}

print(tips_map_values(users, lambda u : u['age'])) # {'Owen': 29, 'Eddie': 15}

Output:

{'Owen': 29, 'Eddie': 15}