question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Value Error due to headers format change/

See original GitHub issue

Hi @fabiobatalha,

It seems like crossref api has made some modifications in header format.

{'date': 'Mon, 26 Jul 2021 11:41:59 GMT', 'content-type': 'application/json', 'transfer-encoding': 'chunked', 'access-control-allow-origin': '*', 'access-control-allow-headers': 'X-Requested-With', 'vary': 'Accept-Encoding', 'content-encoding': 'gzip', 'server': 'Jetty(9.4.40.v20210413)', 'x-ratelimit-limit': '50', 'x-ratelimit-interval': '1s', 'x-rate-limit-limit': '50, 50', 'x-rate-limit-interval': '1s, 1s', 'permissions-policy': 'interest-cohort=()', 'connection': 'close'}

‘x-rate-limit-limit’: ‘50, 50’, ‘x-rate-limit-interval’: ‘1s, 1s’,

Running below code

from crossref.restful import Works
works = Works()
w1 = works.query('zika').sample(20)
for item in w1:
    print(item["title"])

is giving following error:

Traceback (most recent call last):
  File "/home/ankush/.config/JetBrains/PyCharm2021.1/scratches/crossref_scratch.py", line 6, in <module>
    for item in w1:
  File "/media/ankush/ContinentalGroun/workplace/open_source/crossrefapi/crossref/restful.py", line 264, in __iter__
    result = self.do_http_request(
  File "/media/ankush/ContinentalGroun/workplace/open_source/crossrefapi/crossref/restful.py", line 80, in do_http_request
    self._update_rate_limits(result.headers)
  File "/media/ankush/ContinentalGroun/workplace/open_source/crossrefapi/crossref/restful.py", line 43, in _update_rate_limits
    self.rate_limits['X-Rate-Limit-Limit'] = int(headers.get('X-Rate-Limit-Limit', 50))
ValueError: invalid literal for int() with base 10: '50, 50'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fabiobatalhacommented, Jul 26, 2021

Hi @Ankush-Chander;

I have just pushed the workaround to master, can you check if it is working.

1reaction
fabiobatalhacommented, Jul 26, 2021

Related Issue in Crossref API repository : https://gitlab.com/crossref/issues/-/issues/1389

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to correct a #VALUE! error - Microsoft Support
On the Formats tab, click Additional settings. Look for the List separator. If the List separator is set to the minus sign, change...
Read more >
How do I fix the "Missing column headers" error message?
1 Open the import file in Excel. 2 Select everything (Ctrl + A). 3 In the Editing group under the Home tab, click...
Read more >
How to fix the "Invalid Header" error for CSV uploads
This error is usually caused by formatting or white space changes in the header of the CSV file you're attempting to upload.
Read more >
How to Troubleshoot and Fix Excel Pivot Table Errors
This error message might appear if one of the source data headings was changed from UPPER case to Proper case (or any other...
Read more >
Are Excel table headers always converted to text? - Super User
I am understanding your question to mean that you have X-number of columns already headed with dates in the format of dddd, mmmm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found