katsangati / fundingwiki

0 stars 1 forks source link

Difficulties after updating tabledef.json; create throws error #1

Open daaronr opened 5 years ago

daaronr commented 5 years ago

After 'small update' to tabledef.json, changing publish=True in tools table for "secondary papers", and running

python3 main.py official Tools create both

throws error:

    response.raise_for_status()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.airtable.com/v0/appBzOSifwBqSuVfH/Tools/[

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 55, in <module>
    main(args.wiki_version, args.table_name, args.mode, args.resource_type)
  File "main.py", line 30, in main
    manager.create_table_pages()
  File "/Users/yosemite/githubs/fundingwiki/wikimanager.py", line 135, in create_table_pages
    self.table.set_table_page()
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 330, in set_table_page
    new_page = self.format_table()
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 324, in format_table
    table_content += self.automatic_construct_row(record)
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 427, in automatic_construct_row
    cat_id in category_ids]
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 427, in <listcomp>
    cat_id in category_ids]
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/airtable/airtable.py", line 215, in get
    return self._get(record_url)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/airtable/airtable.py", line 188, in _get
    return self._request('get', url, params=processed_params)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/airtable/airtable.py", line 184, in _request
    return self._process_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/airtable/airtable.py", line 173, in _process_response
    raise requests.exceptions.HTTPError(err_msg)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.airtable.com/v0/appBzOSifwBqSuVfH/Tools/[ [Error: NOT_FOUND]

Note the same command works before doing this update

daaronr commented 5 years ago

Now this has fixed (I forgot how I fixed it!) but I'm getting a very similar error when I try to update the papers table:

python3 main.py official papers_mass_qualitative create both Throws:

Traceback (most recent call last):
  File "main.py", line 55, in <module>
    main(args.wiki_version, args.table_name, args.mode, args.resource_type)
  File "main.py", line 22, in main
    manager.setup_table(table_name)
  File "/Users/yosemite/githubs/fundingwiki/wikimanager.py", line 114, in setup_table
    self.table = wikicontents.Table(self.wiki, table_base, table_name, self.user_key)
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 220, in __init__
    self.airtable = at.Airtable(base_name, table_name, user_key)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/airtable/airtable.py", line 129, in __init__
    self.is_authenticated = self.validate_session(self.url_table)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/airtable/airtable.py", line 136, in validate_session
    raise ValueError('Invalid base or table name: {}'.format(url))
ValueError: Invalid base or table name: https://api.airtable.com/v0/appBzOSifwBqSuVfH/Giving_companies
Yosemites-iMac:fundingwiki yosemite$ python3 main.py official Tools create table
Go to tables:tools in your DokuWiki to see the table.
Yosemites-iMac:fundingwiki yosemite$ python3 main.py official papers_mass_qualitative create pages
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/airtable/airtable.py", line 154, in _process_response
    response.raise_for_status()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.airtable.com/v0/appBzOSifwBqSuVfH/papers_mass/T

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 55, in <module>
    main(args.wiki_version, args.table_name, args.mode, args.resource_type)
  File "main.py", line 28, in main
    manager.create_pages()
  File "/Users/yosemite/githubs/fundingwiki/wikimanager.py", line 126, in create_pages
    self.table.set_pages()
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 379, in set_pages
    new_pages = self.format_pages(self.records)
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 373, in format_pages
    page = self.create_page(record)
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 606, in create_page
    variables[meta_pos] = self.make_meta(record)
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 762, in make_meta
    variables = self.fetch_row(self.tabledefs['papers_mass_quantitative'], record)
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 285, in fetch_row
    v[target_format]['linked_column_name'])
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 77, in get_linked_items
    item_names = [airtable.get(item_id)['fields'][linked_column_name] for item_id in item_ids]
  File "/Users/yosemite/githubs/fundingwiki/wikicontents.py", line 77, in <listcomp>
    item_names = [airtable.get(item_id)['fields'][linked_column_name] for item_id in item_ids]
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/airtable/airtable.py", line 215, in get
    return self._get(record_url)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/airtable/airtable.py", line 188, in _get
    return self._request('get', url, params=processed_params)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/airtable/airtable.py", line 184, in _request
    return self._process_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/airtable/airtable.py", line 173, in _process_response
    raise requests.exceptions.HTTPError(err_msg)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.airtable.com/v0/appBzOSifwBqSuVfH/papers_mass/T [Error: NOT_FOUND]
daaronr commented 5 years ago

Another related problem: "[PASSWORD]" is the dokuwiki password of course, which I've just confirmed is working.

yosemite$ python3 main.py official Tools create pages

Traceback (most recent call last):

  File "main.py", line 55, in <module>

    main(args.wiki_version, args.table_name, args.mode, args.resource_type)

  File "main.py", line 21, in main

    manager = wikimanager.WikiManager(wiki_version)

  File "/Users/yosemite/githubs/fundingwiki/wikimanager.py", line 39, in __init__

    os.environ[config[version]["password_key"]])

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dokuwiki.py", line 156, in __init__

    if not self.login(user, password):

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dokuwiki.py", line 219, in login

    return self.send('dokuwiki.login', user, password)

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dokuwiki.py", line 176, in send

    return method(*args)

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/xmlrpc/client.py", line 1112, in __call__

    return self.__send(self.__name, args)

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/xmlrpc/client.py", line 1452, in __request

    verbose=self.__verbose

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/xmlrpc/client.py", line 1154, in request

    return self.single_request(host, handler, request_body, verbose)

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/xmlrpc/client.py", line 1187, in single_request

    dict(resp.getheaders())

xmlrpc.client.ProtocolError: <ProtocolError for david:[PASSWORD]@innovationsinfundraising.org//lib/exe/xmlrpc.php: 401 Unauthorized>

My .bash_profile


# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"

export PATH

#Aliases

alias lf='ls -F'

alias ali='cd /Users/yosemite/;  vim .bash_profile'

alias g='git'

export AIRTABLE_API_KEY="keyoEK2UPGQoBP90Y"

export DOKUWIKI_PASS="[PASSWORD]"

export DOKUWIKI_PASS_TEST="[PASSWORD]"
daaronr commented 5 years ago

Updating this thread...

DR:

I seem to be locked out of the proper access to innovationsinfundraising.org. I can't seem to push anything to the site anymore via the usual tool. I'm following all directions, my password still works to login on Dokuwiki, but I get this 'xmlrpc.client.ProtocolError: <ProtocolError for david:[PASSWorD]@innovationsinfundraising.org/lib/exe/xmlrpc.php: 401 Unauthorized> error.

KA:

Last time I tried to look at the DW I had the same error and I keep getting notifications from the weekly update with the same issue. I tried to resolve it but it seems that even the simplest code doesn't work (initialize DW access and download a page). So it can't be a problem with the overall code. Maybe the DW people changed something in their end - possibly something with authorization. I think the best thing to do would be to setup a fresh DW site (with everything up to date) and try to interact with it from Python (without anything to do with the Airtable). If that works then it means we probably have to update our DW or reset it or something.