import sys
import json
import urllib.request

if len(sys.argv) == 2:
    repository = sys.argv[1]
elif len(sys.argv) > 2:
    print("Usage: next_pr_number.py <repository>")
    sys.exit(1)
else:
    repository = 'astropy/astropy'

with urllib.request.urlopen(f"https://api.github.com/repos/{repository}/issues?filter=all?state=all?sort=created?direction=desc") as response: 
    print(f"Next PR number: {json.loads(response.read())[0]['number'] + 1}")

@@ -307,19 +307,8 @@
 ues?
-filter=all?
 stat
@@ -312,17 +312,17 @@
 tate=all
-?
+&
 sort=cre
@@ -325,17 +325,17 @@
 =created
-?
+&
 directio
@@ -355,17 +355,16 @@
 esponse:
- 
 %0A    pri

fix next PR number script