trying to retrieve comments with activated API key

Drake Gossi drake.gossi at gmail.com
Fri Mar 8 15:43:43 EST 2019


Still having issues:

7. import requests
8. import csv
9. import time
10. import sys
11. api_key = 'PUT API KEY HERE'
12. docket_id = 'ED-2018-OCR-0064'
13. total_docs = 32068
14. docs_per_page = 1000
15.
16. r = requests.get("https://api.data.gov:443/regulations/v3/documents.json
<https://api.data.gov/regulations/v3/documents.json>",
17. params={
18.    "api_key": api_key,
19.    "dktid": docket_id,
 20.    "rrp": docs_per_page,

})

I'm getting an "imported but unused" by 8, 9 & 10.

But then also, on the interactive API
<https://regulationsgov.github.io/developers/console/#!/documents.json/documents_get_0>,
it has something called a "po"--i.e., page offset. I was able to figure out
that "rrp" means results per page, but now I'm unsure how to get all 32000
comments into a response object. Do I have to add an "ro" on line 21? or
something else?

Also, I ran the code as is starting on line 7 and got this:

runfile('/Users/susan/.spyder-py3/temp.py', wdir='/Users/susan/.spyder-py3')

This was in the terminal, I think. Since nothing popped up in what I assume
is the environment--I'm running this in spyder--I assume it didn't work.

Drake

On Fri, Mar 8, 2019 at 12:29 PM Chris Angelico <rosuav at gmail.com> wrote:

> On Sat, Mar 9, 2019 at 7:26 AM Drake Gossi <drake.gossi at gmail.com> wrote:
> >
> > Yea, it looks like the request url is:
> >
> > import requests
> > import csv
>  <-------------------------------------------------------------------on
> these three, I have an "imported but unused warning"
> > import time
> <-------------------------------------------------------------------
> > import sys
>  <-------------------------------------------------------------------
> > api_key = 'PUT API KEY HERE'
> > docket_id = 'ED-2018-OCR-0064'
> > total_docs = 32068  <-but then also, what happens here? does it have to
> do with po   page offset? how do I get all 32000 instead of a 1000
> > docs_per_page = 1000
> >
>
> Can you post on the list, please? Also - leave the original text as
> is, and add your responses underneath, like this; don't use colour to
> indicate what's your text and what you're replying to, as not everyone
> can see colour. Text is the only form that truly communicates.
>
> ChrisA
>



More information about the Python-list mailing list