~josealberto4444/apodnasabot

79584b8e574559d55f22477e7b168a68e7b2eb5b — José Alberto Orejuela García 2 years ago 91e0ec7
Connect to the API
3 files changed, 44 insertions(+), 2 deletions(-)

M Pipfile
M Pipfile.lock
M api.py
M Pipfile => Pipfile +1 -0
@@ 7,6 7,7 @@ verify_ssl = true

[packages]
configparser = "*"
requests = "*"

[requires]
python_version = "3.7"

M Pipfile.lock => Pipfile.lock +37 -1
@@ 1,7 1,7 @@
{
    "_meta": {
        "hash": {
            "sha256": "787a9af6a082f9ce972b3c5bd16222516bc7dd44fdad5f8e57dadc30920973b3"
            "sha256": "e345781a1d6882db32363ca2f62c6c6f27ef534b49b7e3361e859d1e4e596067"
        },
        "pipfile-spec": 6,
        "requires": {


@@ 16,6 16,20 @@
        ]
    },
    "default": {
        "certifi": {
            "hashes": [
                "sha256:046832c04d4e752f37383b628bc601a7ea7211496b4638f6514d0e5b9acc4939",
                "sha256:945e3ba63a0b9f577b1395204e13c3a231f9bc0223888be653286534e5873695"
            ],
            "version": "==2019.6.16"
        },
        "chardet": {
            "hashes": [
                "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
                "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
            ],
            "version": "==3.0.4"
        },
        "configparser": {
            "hashes": [
                "sha256:45d1272aad6cfd7a8a06cf5c73f2ceb6a190f6acc1fa707e7f82a4c053b28b18",


@@ 23,6 37,28 @@
            ],
            "index": "pypi",
            "version": "==3.8.1"
        },
        "idna": {
            "hashes": [
                "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407",
                "sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c"
            ],
            "version": "==2.8"
        },
        "requests": {
            "hashes": [
                "sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4",
                "sha256:9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590f48c010551dc6c4b31"
            ],
            "index": "pypi",
            "version": "==2.22.0"
        },
        "urllib3": {
            "hashes": [
                "sha256:b246607a25ac80bedac05c6f282e3cdaf3afb65420fd024ac94435cabe6e18d1",
                "sha256:dbe59173209418ae49d485b87d1681aefa36252ee85884c31346debd19463232"
            ],
            "version": "==1.25.3"
        }
    },
    "develop": {}

M api.py => api.py +6 -1
@@ 14,8 14,13 @@
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import configparser
import requests

config = configparser.ConfigParser()
config.read('config.cfg')
api_key = config['NASA_API']['api_key']
print(api_key)

baseurl = 'https://api.nasa.gov/planetary/apod'
payload = {'api_key': api_key}
r = requests.get(baseurl, params = payload)
print(r)