Skip to content

Python 3 : TypeError urllib.requests #2

@asalt

Description

@asalt

In python 3 using PubMedClient a type error is obtained.

    >> from bioscraping import PubMedClient
    >> pubmed = PubMedClient(':memory:')
    >> my_pmid = pubmed.fetch('1851123')

    TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.

I have fixed this error like this:

at /bioscraping/pubmed.py in _download(pmid):

24: response = urllib.request.urlopen(request, data=data.encode("utf-8"))

Seems to work in python3 and 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions